Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
svenyonson's avatar
svenyonson
Explorer
9 years ago

How to disable Editor Scripts when building GearVR apps

I am trying to make a Developer Build for a Virtual Reality enabled app. My Android device does not support Editor Mode. I have scripts in my project that I use for generating Asset Bundles. Can I keep these scripts in my project but disable them when building for my Android device? The error is unknown namespace UnityEditor.

2 Replies

Replies have been turned off for this discussion
  • Yes, there are a number of compilation symbols that are set by unity when compiling for a target. For example if you did

    public void Update()
    {
    #if !UNITY_ANDROID
    //This only happens on non android devices
    #endif
    }
    You can have code that only runs if you are not on a android device.

    or if you want your code to only be compiled when running inside the Unity editor do

    public void Awake()
    {
    #if UNITY_EDITOR
    //This only happens if the code is run from inside the editor.
    #endif
    }

    See http://docs.unity3d.com/Manual/Platform ... ation.html for more information about symbols that are available to you when compiling.