- Home /
[iOS/Android] U3D repeats tap to new scene
First, how i detect taps:
if (iPhoneInput.touchCount > 0) {
var touch = iPhoneInput.GetTouch(0);
var pos = touch.position;
var ray : Ray = Camera.main.ScreenPointToRay(Vector3(touch.position.x, touch.position.y));
var hit : RaycastHit;
if (Physics.Raycast(ray,hit))
{
if (hit.collider.name == "new game")
{
.......
Pretty standard. My problem is when user is tapping "Menu" on some level, eg. 9 (Application.LoadLevel(0) is executed) unity is "doubling" this tap in new scene (MainMenu). In the same place where "Menu" button on each level is in MainMenu i have "Continue" button, and in result when I click "Menu" MainMenu flashes, and the same level is opening again. For some odd reason when i manage to click enough fast MainMenu opens, but the whole game just freezes. I've tried adding yield WaitForSeconds(1.0) to Start() in mainmenu script but without effect - MainMenu displays for 1s, and then disappears.
Sorry for my English, I'm from Poland. Hope you've understood my problem, and will help me finding solution.
Your answer
Follow this Question
Related Questions
Script when tapping an object 2 Answers
Mobile Tap Issue 1 Answer
How to make mouse click and tap work in same cases on boxCollider2d 1 Answer
Making projectiles move to a tapped object- Mobile 1 Answer
Making a tap multiplier 1 Answer