Wait action

if(hit.transform.name == “bplay2”
{
// how do i make it so it ill execute next line 2 seconds after i click it
target = targetdirt;
}

SOLVED

              if(hit.transform.name == "bplay2")
				{
				SwitchToPlayMode ();				
				//yield WaitForSeconds(0);
              //	target = targetplaymode;
              	}
	 		}
		}
	}
	
	function SwitchToPlayMode ()
	{
      yield WaitForSeconds(2);
      target = targetplaymode;
      
	}

I. create a “WaitForSeconds” methode:

IEnumerator Wait(float seconds) 
{
Debug.Log("Before Waiting");
yield return new WaitForSeconds(seconds);
Debug.Log("After Waiting "+seconds.ToString()+" Seconds");
}

II. place here(“// how do i make it so it ill execute next line 2 seconds after i click it”):

StartCoroutine(Wait(2f));

III. place your stuff wich should work after the 2 seconds in the “Wait” methode after the “WaitForSeconds”