diff --git a/Runtime/ABase/GameObjectPool/GameObjectPool.cs b/Runtime/ABase/GameObjectPool/GameObjectPool.cs index 92c7cfa..c78be3e 100644 --- a/Runtime/ABase/GameObjectPool/GameObjectPool.cs +++ b/Runtime/ABase/GameObjectPool/GameObjectPool.cs @@ -9,7 +9,6 @@ using UnityEngine; namespace AlicizaX { - /// /// 对象池配置项。 /// @@ -80,6 +79,10 @@ namespace AlicizaX public bool isRefCountReduced; [NonSerialized] public PoolObjectMonitor monitor; + public PooledObject() + { + } + public PooledObject(GameObject go, string path) { gameObject = go; @@ -223,6 +226,7 @@ namespace AlicizaX { availableObjects += queue.Count; } + loadedPrefabs = pool.LoadedPrefabs.Count; assetPaths.Clear(); @@ -248,6 +252,7 @@ namespace AlicizaX objectIndex++; } } + ReleasePoolObjectInfos(objectIndex); int prefabIndex = 0; @@ -267,6 +272,7 @@ namespace AlicizaX info.UpdateFromPrefabRefInfo(kvp.Value); prefabIndex++; } + ReleasePrefabRefInfos(prefabIndex); } @@ -311,6 +317,7 @@ namespace AlicizaX public class ConfigPool { public readonly PoolConfig Config; + // 按资源路径分组的可用对象队列 public readonly Dictionary> AvailableObjectsByPath; public readonly HashSet AllObjects; @@ -536,6 +543,7 @@ namespace AlicizaX // 只需要从集合中移除,不需要减少引用计数 AllObjects.Remove(obj); } + continue; } @@ -611,6 +619,7 @@ namespace AlicizaX queue = new Queue(); AvailableObjectsByPath[pooledObj.assetPath] = queue; } + queue.Enqueue(pooledObj); } } @@ -1358,5 +1367,3 @@ namespace AlicizaX } } } - -