- Home /
Check when OnTriggerEnter() stopped firing
I need to get a list of all objects that are making the trigger trigger. This is easy, but the problem is - I need to know when the OnTriggerEnter has gathered all the objects and added them to a list, simply put - when the list is complete. I am yet to find a good way around doing this. Regards, Adas Lokys
a list of all objects that are making the trigger trigger. This is easy
ok, this is one list, lets call it TriggeredList. I'll assume you don't add duplicates.
when the OnTriggerEnter has gathered all the objects
ok, this is another list, that I assume you have BEFORE you need to check the triggers. Lets call it AllTriggerables
Can't you just compare the Count or Length of both these lists? If equal, all objects have been added. Clear the TriggeredList if you want to start over.
That's the point, there is no predefined list. There can be any number of objects in the trigger area. Once the trigger appears in that area it gathers all the objects that are making it trigger into a list. Now getting when it is complete is another thing.
Ah, "the trigger appears", is important.
Hmm, not really sure about this, but I would suspect(and hope), that you need to wait one FixedUpdate() cycle for all the collision to be detected.
Pardon me if I was not too clear - I've been coding all my waking time through nights for a few days... The entire idea is this, and I will try to be as clear as possible: I'm making a snap area. An object is moving by a certain point and, when it is close enough, a trigger of the same shape as the object appears in that spot. If it picks up that there is another object in the trigger area, it will not allow snapping. Otherwise the object teleports to that place. I know for certain there will be at least 1 trigger at the snap area, so it's a start - if there is more than one, then snapping cannot happen. But the snap function does not wait to find out if there is more than one object in the snap area, so waiting through an entire cycle might be the way. Not sure how to implement it yet.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
[c#] Texture-based Trigger? 1 Answer