[Plugin] Object Pool Component

Heya , Ant chance you can make an official license for this plugin?

MIT would be best for most people.

Another thing that happened was someone with a packaging error failed because he is having this problem:

Guys, let’s have this clear:
“ThreadPool” is NOT my plugin, okay?! :s

There’s quite a few things in UE4 named around the “Pool” word and now I’m getting crash report from people thinking this is the OBJPool module.

Hello ,

I have a question: I have quite a bit of classes that I want to setup ObjectPools for and my idea was to have a Map of Class->ObjectPool. The idea works if setup manually, but I wanted to automatically create ObjectPools for a Class if it didn’t have one already and then after that it’ll start using the new pool, so that I have everything automated. I was faced with an issue though, the fact that I can’t setup the Template class on the ItemsPool class.

How complicated/difficult is it to maybe allow that in future updates?

I’m not sure what you mean.
You can get a pointer to any Pool and do



TemplateClass = MyPooledClass::StaticClass();


I basically want to create Object pools at runtime, set their TemplateClass and store them in a Map so that later, when I want to spot item X, I can call its Pool and spawn from it. So it is possible to do it in C++?

I won’t say creating Pool Components in runtime is a good idea, but I can add a Blueprint function node to “set” Template Class from Blueprint Graphs.

Is this what you’re asking?!

It does suit my needs currently. Because newly spawned actors are added to the pools, it means that I can create pools at runtime for the class that needs it and at the same time not have to specify a specific amount beforehand. So, when we have enough for the current needs, we start reusing the old actors.

It would be nice then yes. What would the process be? create the component, set the class and do initialize?

Yes I will have to add an exposed initialization mechanism for you to manually reserve memory after set Template Class from Blueprint Graph.

Will take a look and test it tonight when I’m back home.

@LatFoued I’ve added this optional Init Pool function; this new node should do it:

I will pack the plugin and send new code to Epic then we wait :slight_smile:

Thank you very much mate :slight_smile: Just a couple small questions, would this be compatible/available for 4.18 and 4.19? and if I have the plugin uninstalled (I have it on the project source to use it in C++), is there an easy way to know that an update has been pushed?

Have a good day.

Yes, I’ve added new node to both versions.
The easiest way to know when there’s an update is check the “Library” in UE4 Launcher. it will display a warning icon the things that have update available in your library…

From there many use perforce diff tools to know what exactly have changed then they merge only the things that matters to their (modified) version of plugin.
I love when they do this because they require less support from me (having a programmer managing this kind of stuff is less margin for human error when dealing with code updates)

For example, I’m not working on 4.18 but 4.19… Have Marketplace version installed on 4.18 and source moved to Project/Plugins on 4.19.
After updating (original code) on 4.18, diff source against 4.19 and merge new lines of new functions needed. Very safe to perform a plugin update this way.

Cheers , all’s working properly *thumbsup

There was a regression related to Particle System Components (this was fixed before on older versions of Unreal, but came back to UE4.18 and UE4.19)
Particles Components from pooled Actors can’t “rewind” emitters because Unreal will ignore a certain function call if any of the Particle Component’s parents is hidden/innactive…

I’ve fixed that again and will submit update 1.5.5 to Epic:

Epic already processed the fix above :slight_smile:

Hello,

Is there a way of resetting the rotation of the pooled objects? My goal is to have all instances use the rotation specified in their classes, but after getting pooled out and then in, I think they’re still at the same rotation they were before.

You can input transform property in Spawn from Pool node options.

On return to pool they are set to zero rotation.

On Pool end play event you could reset transform to defaults.

Hello :slight_smile: Me again haha

I have your plugin files setup in my Plugin folder, so, not using the Engine installed one. It is setup in the build.cs as a dependency “OBJPool”, it is set as installed and everything works like a charm in the Editor. But, when I packaged the game for release, the plugin doesn’t work and it seems like it isn’t getting packaged. Is there some step that I am missing?

Edit: Actually, while looking at the logs, I just found this “Trying to Parse Object-Pool Component, but:: Pool Component is Invalid!”, the game works fine in the Editor or Standalone, but packaged doesn’t. Does the warning have any effect here?

I need logs from packaged game built in developer mode to take a look.

Alright,
This is the first time I use plugins and especially ones that are put inside the project’s plugin folder, not from the Engine. So, which log files do you need exactly? Because that might help me too as I might find the issue myself :slight_smile:

You package your game (not Shipping mode) to desktop.
launch game, play a little; there should be a Logs folder within “Saved” folder inside your packaged directory after you play the game. There should be logs recorded in there.


Btw, I just packaged one of my personal home projects, and pooling is working on the packaged game (4.19).
That error you see in your logs usually means that the Pool Component or its Owner has been deleted or is marked “Pending Kill” while Pooled Actors were still being pooled from that Component.

That shouldn’t happen, this is why I wrote that warning to show up there. It says something is wrong about the lifetime of your Pool Component (probably destroyed for some reason)