- Home /
OnTriggerStay on overlapping objects on instantiate
I have a case in which i want OnTriggerStay
to be called, instead of OnTriggerEnter
-> OnTriggerStay
-> OnTriggerExit
call in cycle.
How this case can be produced: If you instantiate an object on another object like two objects overlapping each other. Both objects have their trigger
enabled, rigidbody attached and non-movable, but not mentioned as static
.
Remember: If a moveable object triggers, it goes through its whole cycle of Enter
, Stay
and Exit
. So, its not an issue of any component not attached to it.
By the research on this case, my understanding to this point that triggering must go in cycle ofMy conclusion:
Enter
, Stay
and Exit
. It can't go directly in Stay state.
Am i right???
Answer by mk26 · Nov 19, 2015 at 06:10 AM
Yes, events works in cycle starting from Enter, Stay and Exit. And Enter should be called before Stay. Elaborated at Colliders Overview, first line of "Trigger" says
The scripting system can detect when collisions occur and initiate actions using the OnCollisionEnter function
Answer by Dinosaurs · Nov 16, 2015 at 05:09 PM
Yes, this is how Unitys collision events work. Enter will always be called before Stay. Please read the documentation before submitting questions to Unity Answers.
Yes, i read the documentation. But there is nothing found similar to Enter should be called before Stay.
Your answer
Follow this Question
Related Questions
How can I make an enemy hurt the player? 3 Answers
OnTriggerStay still called after moving a parent gameobject 0 Answers
OnTriggerStay simple question 1 Answer
OnTriggerStay Weirdness 1 Answer