How to turn off IsTrigger after colliding?

When the player collides with an object I want the score to advance, but I then need the IsTrigger to be turned off, so the Player can not get more than one point per collision. However, I do not want the object to disappear, so although other.gameObject.SetActive (false); works it is not an option.


I have tried many different variations, but have drawn a blank every time. Very, very new to scripting.

void OnTriggerEnter(Collider other)
other.isTrigger = false;
//dont directly try to accesss the class but instead the object you realised from it
//this was niminated as other in your code


Conversly, if it is the collider on the gameobject checking the collision you wish to destroy.
it would be best to cache the transform of the script holding gameobject’s collider into a Collider variable and address it that way [due to readonly clauses on the collider]

        Collider col = gameObject.GetComponent<Collider>();
        col.isTrigger = false;

Place the above code in the OnTriggerEnter method after the “other.isTrigger = false;” line

This might be of interest to you :slight_smile:
Colliders - Unity

Cheers bud, hope it help, let me know if it needs further clarifying

Gruff, thanks but I still have problems. To avoid double jumping I already have an OnTriggerEnter(Collision other) function. If I add 'other.IsTrigger = false: I get text in RED not allowing me to use it If I change the function from (Collision other) to (Collided other) the jump function doesn’t work in the game at all. I’ve also tried variations, but still it doesn’t work.