Question by
ScottishDeano · Mar 05, 2017 at 09:17 PM ·
c#touchontriggerenter
How To Add A Delay When Touched
Hello, I've just joined Unity a few days ago. I would like some help with some code, using C# since that's what it was written on.
void Start()
{
Lap = 0;
SetCountText();
winText.text = "";
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Lap Counter"))
{
Lap = Lap + 1;
SetCountText();
}
}
The code is used for a race track that goes in a circuit. A delay would help to stop people going back and fourth into the sensor to gain laps quickly. I have yet to do a checkpoint system, but I will hopefully find a tutorial on how to do it. Thanks!
Comment
Your answer
Follow this Question
Related Questions
iOS moving up and down question ( code problem ) 0 Answers
OnScreen-Stick that moves to the position touched 0 Answers
Issues trying to activate an image through OnTriggerEnter/Exit/Stay(Flickering) 1 Answer
Setting OnTriggerEnter to a second object collider 2 Answers
C# Touch Input with Raycast on Interactive Map to toggle Canvas 0 Answers