• Pure Pool
  • About Pure Pool issue, Only 1 Object But Show 2 In-pool

Hi,

I have an issue, when use Pure Pool.
The issue is Pool has only 1 Object but Show 2 In-pool.
It maybe cause by my way of use.
If an object release twice, then Pool will has only 1 Object but Show 2 In-pool.

How to avoid to release an object twice,
or how to check if the object is already in pool.

P.S.: This message is the same as mail's message.

    Hello dearchris

    I’m sorry to hear you’re having problems with Pure Pool.

    As you suggest, I think this is occurring because you’re releasing an object that’s already in the pool. I would generally recommend your own code is aware of whether or not the GameObject has been acquired from the pool, or returned to it. If you keep a reference to the spawned GameObject, you should set it to null when you’ve returned it to the pool, so you know not to continue using it.

    If you really need to, you can obtain the PoolableGameObject component on the object (every object created by the pool will have this component), and check the IsInPool property. Sample code would be something like this:

    if (myObject.GetComponent<PoolableGameObject>().IsInPool) {
    // Release here.
    }

    I hope that helps, and please do let me know if you need any further assistance.

    Kind regards,
    Mark

    Write a Reply...