Trigger specific objects

Hey, so I started out making a box collider trigger where, if a basketball goes into a net, a noise is made.

Works fine.

But, I found that if I made a separate trigger, for something else, that trigger applies to that trigger too.
I even specified in the udon graph which objects do what, and its still not working. 1




Any tips? I’m completely stumped.

The OnTriggerEnter event is local to the gameobject it gets called on, so you can’t assign another object to receive the event. The “other” output gives you the object that entered into the trigger on the gameobject this udon behaviour is attached to.
To make sure the object that entered into the trigger is one you want to trigger the audio, you should use a Branch statement to check that the object is the correct one using some information from it, then if true, play the audio source.
For example, you could check the name of the gameobject that entered to make sure it matches a specific name like “BasketBallNet”.

1 Like

Thank you so much. I initially tried the branch idea but then I realized that I had trouble as I don’t know much about how to use it.

I understand how it works in theory. Just not in practice. I shall give it another shot soon.

Any way you could give me a simple example with a screenshot?

I am bound to have issues when I try it. Going to work, now. But tomorrow evening I want to give it a try.

1 Like

Thank you so much.

You’re the best!

That’s what I would have expected but second guessed myself so much.

I’m a weirdo.

Okay awesome. Super excited to try this tomorrow evening.

Thank you so much. Can I somehow put a thank you note in my world to give you some credit or something?

Might make a board or something of special thanks credits.

1 Like

I don’t mind either way, just glad to help!