public static GameObject GetGameObject(this GameObjectPoolComponent self, string path) { if (self.TryGetFromCache(path, out var inst)) { self.InitInst(inst); return(inst); } return(null); }
//异步获取:必要时加载 public static async ETTask <GameObject> GetGameObjectAsync(this GameObjectPoolComponent self, string path, Action <GameObject> callback = null) { if (self.TryGetFromCache(path, out var inst)) { self.InitInst(inst); callback?.Invoke(inst); return(inst); } await self.PreLoadGameObjectAsync(path, 1); if (self.TryGetFromCache(path, out inst)) { self.InitInst(inst); callback?.Invoke(inst); return(inst); } callback?.Invoke(null); return(null); }