UnityRemote and UNITY_IPHONE

Hi everyone,

I’m able to get UnityRemote functioning, no problem, but I noticed that when I’m testing the game with UnityRemote, if I have code like this:

#if UNITY_EDITOR
Debug.Log(“Running editor code!”);
screenPos = Input.mousePosition;
#elif UNITY_IPHONE
Debug.Log(“Running iPhone code!”);
screenPos = myTouch.position;
#endif

It still calls the UNITY_EDITOR code. So, I can understand that the game is, in fact, running in the editor, when I use UnityRemote, but is there any way I can make UnityRemote use the iphone code above? The reason I have the code set up like this is because I want designers to be able to run and control the game with a mouse to speed up iteration.

I figured that a big plus of UnityRemote would be testing out iPhone interface code without building and deploying to the phone, but it doesn’t seem that I can actually do that. Any thoughts?

Hi,
you can approach this problem from other side - if there are no touches your code can check for mouse input.

Does #elif work in javascript…?

function Awake(){
	#if UNITY_EDITOR
	Debug.Log("Running editor code!");
	#elif UNITY_IPHONE
	Debug.Log("Running iPhone code!");
	#endif	
}

Unity complains about semicolons – what am I missing here? Confused…

Sorry, I actually did this in C#. Incidentally, I’m not sure if #elif works properly in C# either, as I was getting some unusual results with that syntax. What I ended up doing was:

#if UNITY_EDITOR
    //editor code
#endif

#if (UNITY_IPHONE || UNITY_ANDROID)
    //mobile code here
#endif

In the end, considering the lag potential, preprocessor issues, and relative ease of just installing the app on the device, I decided Unity Remote is not a worthwhile pursuit for my needs.

Yeah I stopped using unite remote as soon as I was approved as a dev with apple and could compile on device. I might use it again for interface testing though.