diff --git a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs index 0a09c7a..6745e29 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/ThirdParty/UniFramework/UniPooling/Runtime/GameObjectPool.cs @@ -75,9 +75,19 @@ namespace UniFramework.Pooling for (int i = 0; i < _initCapacity; i++) { var operation = AssetHandle.InstantiateAsync(_root.transform); + operation.Completed += Operation_Completed; _cacheOperations.Enqueue(operation); } } + private void Operation_Completed(AsyncOperationBase obj) + { + if (obj.Status == EOperationStatus.Succeed) + { + var op = obj as InstantiateOperation; + if (op.Result != null) + op.Result.SetActive(false); + } + } /// /// 销毁游戏对象池