From c6fe229b4d6c29d22abc63988ca0e6e1a90137bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=80=9D=E6=B5=B7?= <1464576565@qq.com> Date: Wed, 25 Mar 2026 18:41:17 +0800 Subject: [PATCH] Update GameObjectPool.cs --- Runtime/ABase/GameObjectPool/GameObjectPool.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 } } } - -