From 482cd7ce70f204e8c1f24981328f4fa8564c8f2a Mon Sep 17 00:00:00 2001 From: DCFApixels <99481254+DCFApixels@users.noreply.github.com> Date: Fri, 14 Mar 2025 20:33:06 +0800 Subject: [PATCH] fix pool fields --- src/Pools/EcsPool.cs | 10 +++++----- src/Pools/EcsTagPool.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Pools/EcsPool.cs b/src/Pools/EcsPool.cs index 50bd9d5..455e46f 100644 --- a/src/Pools/EcsPool.cs +++ b/src/Pools/EcsPool.cs @@ -45,13 +45,13 @@ namespace DCFApixels.DragonECS private int[] _recycledItems; private int _recycledItemsCount = 0; - private IEcsComponentLifecycle _componentLifecycleHandler = EcsComponentResetHandler.instance; - private bool _isHasComponentLifecycleHandler = EcsComponentResetHandler.isHasHandler; - private IEcsComponentCopy _componentCopyHandler = EcsComponentCopyHandler.instance; - private bool _isHasComponentCopyHandler = EcsComponentCopyHandler.isHasHandler; + private readonly IEcsComponentLifecycle _componentLifecycleHandler = EcsComponentResetHandler.instance; + private readonly bool _isHasComponentLifecycleHandler = EcsComponentResetHandler.isHasHandler; + private readonly IEcsComponentCopy _componentCopyHandler = EcsComponentCopyHandler.instance; + private readonly bool _isHasComponentCopyHandler = EcsComponentCopyHandler.isHasHandler; #if !DISABLE_POOLS_EVENTS - private readonly StructList _listeners = new StructList(2); + private StructList _listeners = new StructList(2); private int _listenersCachedCount = 0; #endif private bool _isLocked; diff --git a/src/Pools/EcsTagPool.cs b/src/Pools/EcsTagPool.cs index 5ce4f10..09789e8 100644 --- a/src/Pools/EcsTagPool.cs +++ b/src/Pools/EcsTagPool.cs @@ -48,7 +48,7 @@ namespace DCFApixels.DragonECS #endif private bool _isLocked; - private T _fakeComponent; + private readonly T _fakeComponent = default; private EcsWorld.PoolsMediator _mediator; #region CheckValide