public static ModelClickEventListener Get(GameObject obj) { ModelClickEventListener del = obj.GetComponent <ModelClickEventListener>(); if (del == null) { del = obj.AddComponent <ModelClickEventListener>(); } return(del); }
void TryClickGameObject(Vector3 position, GameObject obj, bool checkModelClickEventListener = true) { ModelClickEventListener mc = checkModelClickEventListener ? obj.GetComponent <ModelClickEventListener>() : null; if (mc != null) { mc.Fire(position, obj); } else if (onClick != null) { onClick(position, obj); } }