I have a gameobject with a box collider using c# how do i destroy it when the player touches it?

add a script to the object, use OnCollisionEnter, check if it's the player, destroy

1 Answer

1

the example there is almost exactly what you want.

just need to change it to:

public class ExampleClass : MonoBehaviour {
    void OnTriggerEnter(Collider other) {
            if (other.gameObject.tag == "Player"){
                Destroy(gameObject);
            }
    }
}

@Masterio if i understand I should multiply each of the _speed statements by a speed variable?