| | |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | using System.Linq; |
| | | using YooAsset; |
| | | |
| | | |
| | | #if UNITY_EDITOR |
| | | using UnityEngine.Profiling; |
| | |
| | | } |
| | | |
| | | // 启动定期检查池的协程 |
| | | CheckPoolUsage(); |
| | | CheckPoolUsage().Forget(); |
| | | } |
| | | |
| | | private async UniTask CheckPoolUsage() |
| | |
| | | /// </summary> |
| | | /// <param name="prefab"></param> |
| | | /// <returns></returns> |
| | | public GameObjectPool RequestPool(GameObject prefab) |
| | | public GameObjectPool GetPool(GameObject prefab) |
| | | { |
| | | if (prefab == null) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | RequestPool(prefab).Cache(count, _prefabActive); |
| | | GetPool(prefab).Cache(count, _prefabActive); |
| | | } |
| | | |
| | | |
| | |
| | | return null; |
| | | } |
| | | #endif |
| | | return RequestPool(prefab).Request(); |
| | | return GetPool(prefab).Request(); |
| | | } |
| | | |
| | | |