Skip to content

Commit bb981f9

Browse files
authored
Fixed Populate that called on prefabs with Poolable component
1 parent 708cd25 commit bb981f9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Runtime/Pool.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ public static bool TryGetInstancePool(GameObject instance, out Pool pool) =>
6363
public void Populate(int count)
6464
{
6565
for (int i = 0; i < count; i++)
66-
_instances.Push(CreateInstance());
66+
{
67+
var instance = CreateInstance();
68+
instance.gameObject.SetActive(false);
69+
_instances.Push(instance);
70+
}
6771
}
6872

6973
public GameObject Get()
@@ -199,4 +203,4 @@ private void UpdateContainer()
199203
}
200204
#endif
201205
}
202-
}
206+
}

0 commit comments

Comments
 (0)