public class Arrow : MonoBehaviour { public int player = 0; void Start(){ Messenger.AddListener("Destroy Self", destroySelf); } void OnMouseDown(){ Debug.Log("Arrow clicked - "+player); //Turn cam movement back on. GameObject.Find("EditorCamera").GetComponent().moveable = true; //Send message that arrow has been clicked to the level editor (startpoint spawner) Messenger.Broadcast("SetStartSide", gameObject.name +" "+player); //send to all arrows. Messenger.Broadcast("Destroy Self", 0); } void destroySelf(int i){ Destroy(gameObject); } void OnDestroy(){ Messenger.RemoveListener("Destroy Self", destroySelf); Destroy(gameObject); } }