|
Post by chaser324 on Mar 27, 2016 7:43:04 GMT
It appears to me that the version of PoolBoss distributed with Core GameKit (v 3.2.6.4) is not properly recycling elements. What I'm observing is that once I hit the limit on spawned elements, it will then start recycling the first spawned element over and over again. The first time this occurs, it is the expected behavior, but on further events it should be recycling the next oldest element.
Luckily, the apparent bug in the code is pretty easy to spot. In the PoolBoss.Spawn method, you always recycle the first element in the SpawnedClones list, but this element never changes because you never remove it from that list. At the end of the Spawn method you add it again to the SpawnedClones list which is creating duplicate elements in that list.
The easy fix for this is just to remove the element you're recycling from the SpawnedClones list:
...
if (itemSettings.AllowRecycle) { cloneToSpawn = itemSettings.SpawnedClones[0]; itemSettings.SpawnedClones.RemoveAt(0); } else {
...
This way when the item is added to the SpawnedClones list at the end of the function, it's only at the end of the list (i.e. it's the newest spawned), isn't duplicated in the list, and the next object recycled will be the next oldest.
Apologies if I'm not following the correct bug reporting protocol. Let me know if you need anything else from me. This should be very easily reproducible, and the proposed fix should work (it works for me).
|
|
|
Post by chaser324 on Mar 27, 2016 8:08:34 GMT
Actually, it looks like this is fixed in 3.2.6.6 whenever that eventually gets through the submission process.
|
|
|
Post by DarkTonic Dev on Mar 27, 2016 18:05:41 GMT
That is correct. You can email us with your invoice if you don't want to wait.
|
|