Object pool
Example: Creating and Using a Pooled Object
Create a Prefab
using System;
using UnityEngine;
using Zenject;
namespace KrolStudio
{
public class MyObject : MonoBehaviour, IPoolReturnable<MyObject>
{
public event Action<MyObject> OnReturned;
public void ReturnToPool()
{
returned = true;
OnReturned?.Invoke(this);
}
}
}Using a Factory for Object Creation
Factory Overview

Pooling Integration
Connecting the Factory to the Pool
Last updated