void IPoolImplementation.PoolRecycle <T>(ref T obj) { if (this.isNull == true || this.pools.Recycle(ref obj) == false) { PoolInternalBase.CallOnDespawn(obj, null); obj = null; } }
public bool Recycle <T>(ref T obj) where T : class { if (obj == null) { return(false); } if (Pools.isActive == false) { PoolInternalBase.CallOnDespawn(obj, null); obj = default; return(false); } { var type = typeof(T); if (this.pool.TryGetValue(type, out var pool) == true) { pool.Recycle(obj); obj = default; return(true); } } { var type = obj.GetType(); if (this.pool.TryGetValue(type, out var pool) == true) { pool.Recycle(obj); obj = default; return(true); } } return(false); }