- Home /
Conditionally showing virtual joysticks on iOS vs Editor
I'm trying to conditionally show virtual joysticks only when running on an iOS device, and use keys instead in the Editor on my laptop.
I tried the following, and in MonoDevelop the #else clause is dimmed out and I'm not seeing the virtual joysticks on iOS.
if UNITY_EDITOR
leftJoystick.SetActive(false);
rightScreenTap.SetActive(false);
else
leftJoystick.SetActive(true);
rightScreenTap.SetActive(true);
endif
Does anyone know the correct way to do this ?
Thanks
You mean you've properly deployed the game to iOS (not just running it in Unity Remote) and the #else is not firing?
Answer by unimechanic · Oct 03, 2014 at 03:04 PM
in MonoDevelop the #else clause is dimmed out and I'm not seeing the virtual joysticks on iOS.
The #else block will be dimmed because you are in the Editor when writing the scripts. Place a Debug.Log inside the #else block, build & run for iOS, and look for it in the Xcode console. That will tell you if that block is being executed, maybe your method is not being called at all. Or use WIFI debugging to look for the problem:
http://docs.unity3d.com/412/Documentation/Manual/Debugger.html
Your answer
Follow this Question
Related Questions
Trouble downloading iOS Platform editor support 0 Answers
AdMob in Editor? 1 Answer
Detecting iPad with C# 4 Answers
Execute Editor and Android Code Seperately 1 Answer
Removing unneeded shaders Shader Unsupported Hidden/VR/BlitCopyFromTexArray 0 Answers