Collider waiting for two differently tagged game objects to enter before doing something

Hey guys

I’ve asked a question on stack overflow but I guess I’d be more likely to get an answer here!

Using OnTriggerEnter like you are, the code will only work like you want if both the red and green objects enter the trigger area in the same frame.

If you use OnTriggerStay instead, it will fire every frame if something is still in the trigger area. The only problem you will need to overcome, is that if you don’t take precautions against it, your routine will be called repeatedly as long as both objects are still in the trigger area. I would probably use a boolean to decide when to trigger. Set a boolean to true, make sure it is true before executing your method, first thing in the method, set the bool to false so the method is not called again. Then in OnTriggerExit, set it back to true, so if both enter the trigger area again, your method is called again.

Hope this helps,