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?