Having issues with OnPlayerTriggerEnter

So I am having some issues with making a OnPlayerTriggerEnter trigger with a collider. I trying to turn an object on/off when a player enters a collider area. However for some reason I just can’t get it too work, After pulling my hair out a little I ended up following several tutorials but there did the exact same thing I did so I am at a lost.

Originally tried this with Udon Sharp however after no success I ended up making an udon graph but still luck. This is the graph below:

I also ensured the collider has Is Trigger on and tried with and without a rigidbody see images below.

I also tried putting the collider trigger on different layers. I honestly am lost at this point and just feel like I missing something or just being a bit blind.

any help would be greatly appreciated!

1 Like

Hi! Have you tried to use Debug.Log to see if collisions are not the problem? It’s weird because triggers doesn’t need any rigidbody, they are just static gameObjects, be sure is marked as ‘Static’

Hi there,

So I didn’t have the object as static so this is now on however I was still having issues… but after going through my graph again I noticed the connection between IS Valid and the Branch was missing, only stared at the main issue for 2 hours straight but oh well. it’s now working just fine.

Several hours of pulling my hair our later and it turns out to be something so simple. I also fixed my script after realizing it doesn’t check to see the player is valid or not as well of a couple of other things, so that is now working as well.

Also removed the rigidbody and still works fine which I thought it would but most tutorials tell you to add it.

Thanks for your help!

1 Like