示例#1
0
        public bool DetachScript(GameObjectScript e, bool fireDetachScriptEvent = false)
        {
            if (AttachedScripts.Remove(e.TypeHash))
            {
                if (fireDetachScriptEvent)
                {
                    e.OnDetach(m_OwningObject);
                }
                return(true);
            }

            foreach (GameEventType eid in e.ListeningEvents)
            {
                UnSubscribeFromEvent(eid, e);
            }

            return(false);
        }