Question by 
               ibrahimmunaser · Nov 21, 2015 at 09:03 PM · 
                c#objectdestroymove  
              
 
              Destroy object on click? UNITY
Hi guys! lets say I have Object A and Object B. I want... if i click Object A then I want Object B to get destroyed. How do I do that in unity???
               Comment
              
 
               
              Answer by Vunpac · Nov 21, 2015 at 09:13 PM
It would look something like this.
 using UnityEngine;
 using System.Collections;
 
 public class DestoryObject : MonoBehaviour 
 {
     public GameObject objectToDestroy;
 
     void OnMouseDown () 
     {
         Destroy(objectToDestroy);
     }
 }
You would put this script on object A and drag objectB into the objectToDestroy slot in the editor.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                