Skip to content

Object Pooling

DucNV_2000 edited this page Jun 13, 2024 · 3 revisions

Use

  • Init Pool
    Pool.InitPool();

Example

    public GameObject prefab;

    private GameObject ins;

    void SpawnIns()
    {
        ins = Pool.Spawn(prefab);
    }

    void DeSpawnIns()
    {
        Pool.DeSpawn(ins);
    }

Or

    public GameObject prefab;

    private GameObject ins;

    void SpawnIns()
    {
        ins = prefab.Spawn();
    }

    void DeSpawnIns()
    {
        ins.DeSpawn();
    }
Clone this wiki locally