onTriggerEnter not functioning correctly? (C#)

New to using Unity / C#, so it may be something naive, but i’ve read across a bunch of other solutions, and cant seem to get this to work.

I’m attempting to get the Player (with Cylinder Collider, is trigger turned on), to pick up a potion (box collider, rigidbody)

void onTriggerEnter(Collider other) {
if (other.gameObject.CompareTag(“PickUp”))
{
health.CurrentVal -= 10;
other.gameObject.SetActive (false);
}
}

This is the code on a script attached to the player object.
I’ve checked that all tags are correct and accurate, that they are both on the default layer, and collision between it is turned on.

I’ve tried switching it around and making the potion object the trigger, and disabling the trigger on the player object, and that hasnt worked either.

Any suggestions as to what i may be doing wrong?

Try “OnTriggerEnter” ( with capital ‘O’ )

i did’nt understand your problem completely but i can recommend some solutions if that works, great!

First of all is “isTrigger” turned on for both the colliders?

Second of all you can try using OnTriggerExit ? maybe it’ll work!

Comment Your Queries!