# UnityRemote and UNITY\_IPHONE

**URL:** https://discussions.unity.com/t/unityremote-and-unity-iphone/436062
**Category:** Mobile
**Tags:** iOS
**Created:** [February 9, 2011, 7:18pm UTC](https://discussions.unity.com/t/unityremote-and-unity-iphone/436062 "2011-02-09T19:18:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![kromenak](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kromenak/32/593549_2.png) [@kromenak](https://discussions.unity.com/u/kromenak)
#### Post date: [February 9, 2011, 7:18pm UTC](https://discussions.unity.com/t/unityremote-and-unity-iphone/436062/1 "2011-02-09T19:18:44Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Mantas-Puida](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@Mantas-Puida](https://discussions.unity.com/u/Mantas-Puida)
#### Post date: [February 11, 2011, 5:09pm UTC](https://discussions.unity.com/t/unityremote-and-unity-iphone/436062/2 "2011-02-11T17:09:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![J\_P](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/j_p/32/164924_2.png) [@J\_P](https://discussions.unity.com/u/J_P)
#### Post date: [February 15, 2011, 9:58pm UTC](https://discussions.unity.com/t/unityremote-and-unity-iphone/436062/3 "2011-02-15T21:58:52Z")

</div>

Does #elif work in javascript…?

```auto
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…

---

<div class="post-metadata">

### Author: ![kromenak](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kromenak/32/593549_2.png) [@kromenak](https://discussions.unity.com/u/kromenak)
#### Post date: [February 15, 2011, 10:53pm UTC](https://discussions.unity.com/t/unityremote-and-unity-iphone/436062/4 "2011-02-15T22:53:53Z")

</div>

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:

```auto
#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.

---

<div class="post-metadata">

### Author: ![J\_P](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/j_p/32/164924_2.png) [@J\_P](https://discussions.unity.com/u/J_P)
#### Post date: [February 15, 2011, 10:55pm UTC](https://discussions.unity.com/t/unityremote-and-unity-iphone/436062/5 "2011-02-15T22:55:23Z")

</div>

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.
