I’m working on an android game and I got a simple code for touching a button with a tag.
But when you touch the button it loads a new scene wich has another button on the exact same spot and when I try it out on my phone when I touch the first button the game loads the new scene and immediately touches the second button to so i can’t touch the first button without touching the second one. I would like to have a delay that you can’t touch anything for 1 second or so.
Here is my code:` #pragma strict
var knop : GameObject;
var knopingedrukt : GameObject;
function Start () {
knop.renderer.enabled = true;
knopingedrukt.renderer.enabled = false;
}
function Update ()
{
if (Input.touchCount > 0)
{
var ray = Camera.main.ScreenPointToRay (Input.GetTouch(0).position);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit))
{
if(hit.collider.tag == "knop")
{
knop.renderer.enabled = false;
knopingedrukt.renderer.enabled = true;
Application.LoadLevel ("Classic");
}
}
}
}`