update space shooter

main
hevinci 2023-06-05 18:04:09 +08:00
parent 93b58149d2
commit fcf9eff2f6
1 changed files with 10 additions and 0 deletions

View File

@ -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);
}
}
/// <summary>
/// 销毁游戏对象池