I guess because all of them have the tag "resource". You should check if *this* is the clicked object or destroy the object which was hit.
(code not tested)
if (hit.gameObject.Equals(gameObject))
{
Destroy(gameObject);
}
or
if (hit.transform.tag == "resource")
{
Destroy ( hit.gameObject );
}
↧