public static LateUpdateListener Get(GameObject go, string listenerTag = null) { LateUpdateListener[] listeners = go.GetComponents<LateUpdateListener>(); LateUpdateListener listener = FindListener(listeners, listenerTag); if (listener == null) { listener = go.AddComponent<LateUpdateListener>(); listener.listenerTag = listenerTag; } return listener; }
private void AddLateUpdateListener() { Action <LuaTable> luaLateUpdate = m_LuaTable.Get <Action <LuaTable> >("LateUpdate"); if (luaLateUpdate != null) { LateUpdateListener listener = LateUpdateListener.Get(this); listener.lateUpdate = luaLateUpdate; if (!m_BehaviourListenerSet.Contains(listener)) { m_BehaviourListenerSet.Add(listener); } } }