Skip to content

Commit edf891a

Browse files
authored
Update Poolable.cs
1 parent b536db7 commit edf891a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Poolable.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using UnityEngine;
1+
using UnityEngine;
22
using UnityEngine.Events;
33

44
namespace ToolBox.Pools
@@ -13,6 +13,7 @@ public class Poolable : MonoBehaviour
1313

1414
private bool isPooled = false;
1515
private bool isEnabled = true;
16+
private bool wasSpawnedBefore = false;
1617

1718
public void ReturnToPool()
1819
{
@@ -27,7 +28,11 @@ public void ReturnToPool()
2728

2829
public void ReturnFromPool()
2930
{
30-
OnBackFromPool?.Invoke();
31+
if (wasSpawnedBefore)
32+
OnBackFromPool?.Invoke();
33+
else
34+
wasSpawnedBefore = true;
35+
3136
isEnabled = true;
3237
}
3338

0 commit comments

Comments
 (0)