Example #1
0
        // 给一个GameObject添加Message组件 —— 换种说法就是获取一个GameObject的MonoBehaviour消息
        public static LuaMessage Require(GameObject obj)
        {
            LuaMessage transmitter = obj.GetComponent <LuaMessage>();

            if (transmitter == null)
            {
                transmitter = obj.AddComponent <LuaMessage>();
            }
            return(transmitter);
        }
Example #2
0
        public static void Dismiss(GameObject obj)
        {
            if (obj == null)
            {
                return;
            }
            LuaMessage message = obj.GetComponent <LuaMessage>();

            if (message == null)
            {
                return;
            }
            message.Dismiss();
        }