How to detect Unity Remote?

Can we detect Unity Remote running from our script?

Thanks in advance for your help.

2 Answers

2

The following seems to work in Unity 5.3:

	bool enabled = false;
	#if UNITY_EDITOR
	if (UnityEditor.EditorApplication.isRemoteConnected) {
		enabled = true;
	}
	#endif

Works, but keep in mind that it takes a second or two until the Remote connects to the editor. So if you are checking somewhere in Awake() it might still be false.

A combination of Application.platform and Input.touchCount should get you what you need.

Example:

if ((Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor) && Input.touchCount != 0)
     Debug.Log("Using Unity Remote");

What a pity, doesn't work with Unity Remote 4 and 4.6.2 and I didn't found another way yet