Forum Discussion
svenyonson
9 years agoExplorer
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
- leftlerProtegeYes, there are a number of compilation symbols that are set by unity when compiling for a target. For example if you did
You can have code that only runs if you are not on a android device.
public void Update()
{
#if !UNITY_ANDROID
//This only happens on non android devices
#endif
}
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. - CodingJarProtegeTypically if you have a script that is only executed in the Editor (such as your Asset Bundle generator), you should be putting them in an Editor/ directory. Here's the manual on Special Folders: http://docs.unity3d.com/Manual/SpecialFolders.html.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 6 months ago
- 11 months ago
- 10 months ago