Skip to content

Commit a3c5085

Browse files
authored
Update Pool.cs
1 parent faf8c40 commit a3c5085

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Runtime/Pool.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,16 @@ public GameObject Get(Vector3 position, Quaternion rotation, Transform parent)
100100

101101
public void Release(GameObject instance)
102102
{
103+
var poolable = instance.GetComponent<Poolable>();
104+
poolable.OnRelease();
105+
103106
instance.SetActive(false);
104107

105108
var instanceTransform = instance.transform;
106109
instanceTransform.SetParent(null);
107110
instanceTransform.rotation = _rotation;
108111
instanceTransform.localScale = _scale;
109112

110-
var poolable = instance.GetComponent<Poolable>();
111-
poolable.OnRelease();
112113
_instances.Push(poolable);
113114
}
114115

0 commit comments

Comments
 (0)