Simple OnTriggerEnter/ OnTriggerExit graphs to turn on/off object

Hey everyone, I’ve made few simple trigger graphs that I’ve made for my world which I want to share to help others like me (with no experience in coding).

Now I will list few things to make your trigger work correctly.

  1. Create Cube with checked “Is Trigger” in box collider section,
  2. Add Udon Behaviour in “Add Component” section.
  3. Disable “Mesh Renderer”.
  4. In Udon Behaviour section place your Game Object that you want to enable/disable.
  5. When you place your cube make sure it’s high enough to interact with player.

My main graph (Multi time use) OnTriggerEnter with OnTriggerExit It will Turn On Game Object when you enter the collider then it will Turn it Off after you leave the trigger zone.
Keep in mind this graph will always try to Turn On the object first that’s why you should keep game object off when you set it in your world.

OnTriggerEnter Off (Single Use Trigger)

OnTriggerEnter On (Single Use Trigger)

Last Graph is similar to the first but it will detect if the object is already On or Off (Useful when several players stands on 1 collider) At least it looks like it doing it haha.

,

I hope it will help someone with his/her world ;]. Remember I have no idea what I’m doing but the graphs are working for me in the way I wanted them to work, so that’s a small achievement for me. If any1 have questions or suggestions feel free to ask, I will try to help.

1 Like