Hi, i need to destroy an object if a statement is true.
Im not using collider or ray on the object.
I would like to have the code on one object, and destroy another object.
The object i want to destroy is named and unique.
How do i do this?
i managed to destroy itself, but not the specific object.
The info at Script reference is very sparse and i would love any info on the function destroy :)
asked Jul 14 '12 at 12:13 AM
The destroy function needs the reference of an object. It can be either a GameObject or a component. To find that reference, you have a lot of ways (Find, FindWithTag, FindObjectOfType, public var assigned in the inspector, OverlapSphere etc).
You need to define clearly what trigger the destruction. A physic event, an input, time, something else ?
answered Jul 14 '12 at 12:28 AM