- Home /
Stay in Trigger Range Script...
I'm fooling around making a horse-shoe toss game and I want to ensure the horse shoe stays around the post not just breifly touches it.
Usually for a trigger script you do: OnTriggerEnter...... but how do you check to see if the gameobject that triggered the trigger stays in the boundary for 3 seconds?
Is that even possible?
If so, how can you do it?
Answer by StephanK · Jun 21, 2010 at 02:15 PM
There's a OnTriggerExit() method. Just store the time it entered and if it exits check if the 3 seconds are up.
But in this case the GameObject isn't supposed to exit the collider...Just stay within it for 3 seconds. A horseshoe is tossed and in order to score it stay connected to the ring for 3 seconds. The horeshoe never leaves the collider.
Answer by BoredKoi · Jun 23, 2010 at 12:05 PM
There is also OnTriggerStay() -- do your time counting there.
Your answer
![](https://koobas.hobune.stream/wayback/20220613062619im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Regarding dragging objects and boundries. 1 Answer
Can't click gameobject when over another trigger? 1 Answer
Clamp camera within bounds of a Complex Mesh? 2 Answers
Inverse 2D Collider, is this possible? 0 Answers
Area sensing - Needs fixing 1 Answer