I have 3d game objects (with colliders) and when the mouse clicks them, they load certain levels, here is the script attached to those objects:
#pragma strict
function Start () {
}
function OnMouseDown () {
Application.LoadLevel ("Brink_Day_UI");
}
Searched the scripting doc but couldn’t find a simple function to replace the “OnMouseDown” function on iPAD. Any ideas?
There is not event / Function that gets called but this should work.
#pragma strict
function Update () {
if (Input.touchCount > 0) {
Application.LoadLevel ("Brink_Day_UI");
}
}
(Maybe this could be designed better.)
The usual technique is to use raycasting (which is what OnMouseDown actually does behind the scenes anyway).
–Eric
mtoivo
4
I’ve used Input.GetMouseButtonDown along with raycasting, works with mouse single touch as well, which is nice.