Exemplo n.º 1
0
        public static MLuaUIListener Get(GameObject go)
        {
            if (!go)
            {
                return(null);
            }
            MLuaUIListener listener = go.GetComponent <MLuaUIListener>();

            if (!listener)
            {
                listener = go.AddComponent <MLuaUIListener>();
            }
            return(listener);
        }
Exemplo n.º 2
0
        public static void Destroy(GameObject go)
        {
            if (!go)
            {
                return;
            }
            MLuaUIListener listener = go.GetComponent <MLuaUIListener>();

            if (listener)
            {
                if (Application.isEditor && !Application.isPlaying)
                {
                    UnityEngine.Object.DestroyImmediate(listener);
                }
                else
                {
                    UnityEngine.Object.Destroy(listener);
                }
            }
        }