// Update is called once per frame void Update() { if (!controlsEnabled) { return; } //multitouch if (Input.touchCount > 0) { Vector3[] touches = new Vector3[Input.touchCount]; //Find the position in the scene of each touch for (int i = 0; i < Input.touchCount; i++) { Vector3 touchposition = Input.touches[i].position; if (worldSpaceTouchPositions == true) { touchposition = Camera.main.ScreenToWorldPoint(touchposition); //For 2D games we zero the z positions } if (zeroZPositions == true) { touchposition.z = 0.0f; } touches[i] = touchposition; } MobileControls.OnTouch(touches); } //MobileControls.OnTouch(Input.touches); }
// Update is called once per frame void Update() { if (!controlsEnabled) { return; } //For desktop, V and H axis control X and Z respectively, Y is 0 if (MobileGameManager.IsDesktop) { Vector3 keysTilt = new Vector3(Input.GetAxis("Vertical"), 0.0f, Input.GetAxis("Horizontal")); if (alwaysPublish || keysTilt != lastTilt) { MobileControls.OnTilt(keysTilt); lastTilt = keysTilt; } } else { if (alwaysPublish || Input.acceleration != lastTilt) { MobileControls.OnTilt(Input.acceleration); lastTilt = Input.acceleration; } } }