public void OnPointerClick(PointerEventData eventData) // 3 { if (this.GetComponent <Text>().color == GREY) { selected = false; } else { selected = true; } GameObject bg = GameObject.Find("background"); Deselection deselection = bg.GetComponent <Deselection>(); deselection.deselectAll(); sound.Play(); if (selected) { this.GetComponent <Text>().color = GREY; } else { this.GetComponent <Text>().color = Color.red; } selected = !selected; }
private void Deselect() { Deselection?.Invoke(this, new EventArgs()); }