|
@@ -1,4 +1,5 @@
|
|
|
-using UniFramework.Pooling;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using UniFramework.Pooling;
|
|
|
using UnityEngine;
|
|
|
using YooAsset;
|
|
|
|
|
@@ -31,19 +32,19 @@ namespace GFGGame
|
|
|
return handle.GameObj;
|
|
|
}
|
|
|
|
|
|
- //public async Task<GameObject> SpawnASync(string resPath)
|
|
|
- //{
|
|
|
- // if (!_entitySpawner.IsGameObjectPoolExisted(resPath))
|
|
|
- // {
|
|
|
- // // 创建游戏对象池,销毁时间单位为秒
|
|
|
- // _entitySpawner.CreateGameObjectPoolSync(resPath, false, 0, 1, 60);
|
|
|
- // }
|
|
|
+ public async Task<GameObject> SpawnAsync(string resPath)
|
|
|
+ {
|
|
|
+ if (!_entitySpawner.IsGameObjectPoolExisted(resPath))
|
|
|
+ {
|
|
|
+ // 创建游戏对象池,销毁时间单位为秒
|
|
|
+ _entitySpawner.CreateGameObjectPoolSync(resPath, false, 0, 1, 60);
|
|
|
+ }
|
|
|
|
|
|
- // SpawnHandle handle = _entitySpawner.SpawnAsync(resPath);
|
|
|
- // await handle.Task;
|
|
|
- // AssetReleaserHelper.AddReleaserToSpawnObj(handle.GameObj, resPath, handle);
|
|
|
- // return handle.GameObj;
|
|
|
- //}
|
|
|
+ SpawnHandle handle = _entitySpawner.SpawnAsync(resPath);
|
|
|
+ await handle.Task;
|
|
|
+ AssetReleaserHelper.AddReleaserToSpawnObj(handle.GameObj, resPath, handle);
|
|
|
+ return handle.GameObj;
|
|
|
+ }
|
|
|
|
|
|
public GameObject InstantiateSync(string resPath)
|
|
|
{
|