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???
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.
what about click twice to destroy