Ok basically there are spawners that spawn multiple versions of a prefab object called "Crate" The "Crate" has this script attached which basically says that when I press the pickup button it will destroy the object so it disappears and shows animated in my hands. Now when the crates spawn they are all called Crate(Clone) with these scripts attached Now when i press Q all the crates destroy but i only want 1 of them to get destroyed how do i fix this? Do i need to attach several versions of the script to several different objects or is there a faster way?
function Update ()
{
if( Input.GetKeyDown ("q") && GameObject.Find("Player").GetComponent(BoxPick).enabled == true)
Destroy(gameObject);
}