↧
Answer by ICHeeryI
Here is code: //Destroy object on click var hit : RaycastHit; var ray = Camera.main.ScreenPointToRay (Input.mousePosition); if ( Physics.Raycast ( ray, hit, 100 )) { if (...
View ArticleAnswer by robhuhn
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)) {...
View ArticleAnswer by DeveshPandey
Add one more condition like- if (hit.transform.tag == "resource" && hit.gameObject == gameObject) { Destroy ( gameObject ); }
View Article