void Awake() { if (reddot == null) { // DontDestroyOnLoad(gameObject); reddot = this; } else if (reddot != this) { Destroy(gameObject); } }
void OnTriggerEnter(Collider other) { if (other.tag.Equals("Reddot_1")) { RedDot1 red1 = other.GetComponent <RedDot1>(); if (red1 != null) { red1.isFrozen = true; //froze the ball mylist1.Add(red1); } } else if (other.tag.Equals("Reddot_2")) { RedDot2 red2 = other.GetComponent <RedDot2>(); if (red2 != null) { red2.isFrozen = true; mylist2.Add(red2); } } else { } }