public static void SendEvent(int guid, CEvent e) { NetBehaviour behaviour = GUIDPool.GetBehaviour(guid); if (behaviour != null) { behaviour.AcceptEvent(e); } }
public void Awake() { instance = this; foreach(ReservedGUID res in FindObjectsOfType<ReservedGUID>()) { var id = new NetGUID(res.id); NetBehaviour netBehaviour = res.GetComponent<NetBehaviour>(); netBehaviour?.SetGUID(id); id.behaviour = netBehaviour; current = System.Math.Max(current, res.id + 1); } }
public static T GetObject<T>(int id) where T : Component { NetBehaviour behaviour = GetBehaviour(id); return behaviour?.GetComponent<T>(); }