Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Assets/uPools/Runtime/SharedGameObjectPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public static GameObject Rent(GameObject original)
}

cloneReferences.Add(obj, pool);

PoolCallbackHelper.InvokeOnRent(obj);

return obj;
}

Expand All @@ -64,6 +67,9 @@ public static GameObject Rent(GameObject original, Transform parent)
}

cloneReferences.Add(obj, pool);

PoolCallbackHelper.InvokeOnRent(obj);

return obj;
}

Expand All @@ -90,6 +96,9 @@ public static GameObject Rent(GameObject original, Vector3 position, Quaternion
}

cloneReferences.Add(obj, pool);

PoolCallbackHelper.InvokeOnRent(obj);

return obj;
}

Expand Down Expand Up @@ -117,6 +126,9 @@ public static GameObject Rent(GameObject original, Vector3 position, Quaternion
}

cloneReferences.Add(obj, pool);

PoolCallbackHelper.InvokeOnRent(obj);

return obj;
}

Expand Down Expand Up @@ -148,6 +160,8 @@ public static void Return(GameObject instance)
instance.SetActive(false);
pool.Push(instance);
cloneReferences.Remove(instance);

PoolCallbackHelper.InvokeOnReturn(instance);
}

public static void Prewarm(GameObject original, int count)
Expand All @@ -161,6 +175,8 @@ public static void Prewarm(GameObject original, int count)
var obj = UnityEngine.Object.Instantiate(original);
obj.SetActive(false);
pool.Push(obj);

PoolCallbackHelper.InvokeOnReturn(obj);
}
}

Expand Down