Created
September 18, 2015 17:09
-
-
Save rbaulin/cd1ec1514858a53b1f66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// unity pc and mobile input | |
// http://docs.unity3d.com/ScriptReference/Input.GetMouseButtonDown.html | |
// http://docs.unity3d.com/Manual/MobileInput.html | |
void Update() { | |
if (SystemInfo.deviceType == DeviceType.Desktop) { | |
if (Input.GetMouseButtonDown(0)) {// 0 - left click, 1 - right click, 2 - middle click | |
// click | |
} | |
} else { | |
for (var touch : Touch in Input.touches) { | |
if (touch.phase == TouchPhase.Began) { | |
// tap | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment