public void Awake() { background = GetComponent <Image>(); this.width = this.GetComponent <Image>().sprite.rect.width; this.height = this.GetComponent <Image>().sprite.rect.height; this.listener = UIEventListenerBasic.Get(this.background.gameObject); }
public static UIEventListenerBasic Get(GameObject go) { UIEventListenerBasic listener = go.GetComponent <UIEventListenerBasic>(); if (listener == null) { listener = go.AddComponent <UIEventListenerBasic>(); } return(listener); }