I want to make it so that when the player touches this object, it destroys a different object.
I attach this script to the trigger, so that way when the player touches this trigger, a separate object called “Sucks2” is destroyed.
function OnTriggerEnter(other : Collider) {
if (other.tag == "Player") {
Destroy(gameObject.name == "Sucks2");
}
}
but I get this error message:
“BCE0020: An instance of type ‘UnityEngine.Object’ is required to access non static member ‘name’.”
why? how do I fix this?