[Plugin] Object Pool Component

I had some time to look into this today and submitted to Epic for review a “v2” update for Unreal 4.25 that supports “Debug Game” builds and uncooked “Launch from Editor” runtimes.

Right on, thanks for your help, it’s a great tool.

Wait for 4.26 update.

All plugins I publish have been updated, you have to wait for Epic to release them.

Thanks for the updates. Been a must have plug-in. Is the update packing game normally? I built version from source meanwhile and getting unknown structure error from PoolSpawnOptions used for Character-pool spawn.

Every major engine release requires changes to plugin code. I don’t remember exactly what I changed on this one anymore, but I remember was a 2 minutes fix and was ready to submit update for review.

Question on best practises: We have a game where we have a single pawn that goes around the level and there are 2 types of TargetBP s to Shoot Each Spawns a different type of Score Widget BP when hit and it disappears and goes back to the pool. Each TargetBP I have a pool of 9 ScoreBP Actors - I have 60 Targets (and you can only shoot one at a time) do they all share those pooled actors or should I be setting up a 'Shared pool actor"? Each Target will only spawn a single ScoreBP at a time… ( I was thinking the 9 would be for the level - need confirmation) -

Also can you put shared pool items into the gamemode BP? That can be called from any BP and is a truly single object and map/level independant?

Thanks

You can add pool component to any Actor, including Game Mode actor.

It’s a matter of preference, but I wouldn’t add a pool component to each target, I would use only one for all of them and move spawn origin to current target when needed.

Thanks - Perfect I have the Gamemode holding lots of variables so makes better sense to do it there… I can Cast to the BP and spawn the pooled the actors from there from the Target BP.

So I have a question…
Is there a way to respawn a specific actor from the pool? Say if I had a reference to a particular bullet and I wanted it to behave in a particular manner is there a helper function that would allow me to reactivate it from said actor?

nvm answered my own question, just used the pool actors SpawnFromPool method, I was a little confused since there seems to be a number of functions with the same exact name and somewhat different functionality.

Hi , I’m considering purchasing Object Pool but want to make sure it’s the right solution for me. My problem is that I’m experiences lag when spawning/destroying my enemy characters.

My enemy characters:

  • all use the same aiController
  • all use the same behavior tree
  • multiple enemy character types just use different Skeletal Meshes

Do you think Object Pool will be an effective solution for eliminating the lag?
Do you think it will optimize having 40+ enemies at once and result in better frame rates?

Thank you!
Chris

@DreamJob100

Yes plugin was made to work around runtime freezes when frequently spawning and destroying actors of a same class.
But keep in mind that, if you are trying to pool actors running Niagara systems, you must disable GPU pooling on your particle system or Niagara might cause crashes when the plugin disable those pooled particle components.

Your character class also must be adjusted to be a child class of “Pooled Character” class to make it work, for some people this could be a problem.

I’ve purchased the asset and I have implemented the system. My problem is that I’m getting significant frame stutters when spawning from the Pool. I’m using 4.25. It’s quite strange. Even teleporting the actor from 1 location to another is causing quite a frame stutter. Any suggestions? I can make a sample project if that helps. Thanks!

Yes send me a dropbox link so I can take a look on how you’re using it.

Hello ,

I am in the process of upgrading my project from 4.24 to 4.26 and I noticed that my old setting of InstantiateOnDemand=true is not being taken into account any more, I can’t see the ObjPool settings in the ProjectSettings and the old settings were in DefaultGame.ini as:


[/Script/OBJPool.PoolSettings]
ReinitializeInstances=True
InstantiateOnDemand=True
NeverFailDeferredSpawn=False
KeepOrphanActorsAlive=False

And they aren’t being taken account. Any tips on this?

Thanks

EDIT: I can’t tell where the plugin is picking the settings, but for now I forced the value to true in code.

@LatFoued Was requested by a lot of users, so those settings were moved to the Pool Component; you can edit them from Details Panel of your components.

I see, issue is, I use dynamically created pool components (I don’t know if you remember but I was the one mainly behind the requested “InitializeObjectPoolWithNewTemplateClass”, so maybe in the future we can see that function or another one which accepts those settings as well. I’ll leave it hard coded on my end for now, as I only use it with InstantiateOnDemand=True

Thanks :slight_smile:

Hello, where can I disable the GPU pooling in Niagara?

@MikeGK3 You have to activate “Force Solo” option on your Niagara Component.
Niagara will disable GPU pooling and allow you to do CPU pooling of the component: