Thanks Bruno, I was just wondering if you implemented something for this case.
I wondered because I can not tell if a pool of e.g. 1k is enough for projectiles in all cases. Players would be upset if their headshot is projectile #1001 and won't get spawned because the pool is full That's why I asked.
Last edited by Ben_Cykyria; 02-13-2017, 12:55 PM.
Reason: there/their -.-
What happens if I have to spawn more actors then the pool size? will the pool size increase dynamically?
Doing that will defeat the concept of object pool.
There's an option in Project Settings to enable this, but doing so you will fire SpawnActor<>() function and break the "pooling" cycle; for this reason I have not invested too much on this functionality, depending on what you do it will not work as expected.
This second option, it's left disabled by default:
Does this plugin support c++ Actor ? And how to pool the particles?
Yes, you can use any C++ Actor class with this as well as Blueprints.
If the particle is attached to a pooled Actor, you can use the "Pool Begin Play" and "Pool End Play" events on that Actor, to activate/deactivate particle effects.
Quick question: To get an actor spawned from the pool to tick i have to enable ticks in the On Pool Begin Play? It was the only way i could get ticks to work. (and probably a stupid follow up question; should i then disable ticks before returning it to the pool? )
Essential plugin but having crash-issue with 4.14. Seems like if the pool have some destroed actors, then the editor crashes when "empty object pool"-node is used, the related blueprint (that have the pool) is destroyed or play in viewport session is ended.
Thanks, I will check this right now.
Just keep in mind that pooled objects are not supposed to be destroyed (destroy the pool owner instead), but it shouldn't crash because of that, I will see where the mistake is.
Edit:
[MENTION=50574]SaOk[/MENTION]
Thank you for finding this issue;
I have found the crash reason, I've fixed it and will submit to Epic as soon as I can.
The thing is, I forgot about one thing: to check if any of Pooled Actors are marked by the engine as Pending Kill before I tell the Pool Component to be empty.
The result is that once you destroy a pooled actor, it is not immediately gone... It is marked as pending kill until GC is able to collect, but there's a pointer in the Pool holding reference to the destroyed Actor and once you use the 'Empty Pool' in this case you are actually calling Destroy() function 3x on an Actor that is not valid anymore.
I just had to check if the pooled Actors are valid at low level, just one line of code inside the Empty Pool function.
Essential plugin but having crash-issue with 4.14. Seems like if the pool have some destroed actors, then the editor crashes when "empty object pool"-node is used, the related blueprint (that have the pool) is destroyed or play in viewport session is ended.
Leave a comment: