[Plugin] Object Pool Component

I had the same issue with my overlaps all triggering at once. I use begin play and moved them to a coordinate (z = -1000) where I knew they wouldn’t trigger. Worked like a charm, thanks for figuring that out!

Given everything in a pool seems to spawn at 0,0,0 this is the only workaround I have found, is there a way to delay events or something? I tried unchecking start on tick and auto initialize but that didn’t work.

All you need is a proper collision channel setup.
Make your collision channel ignore itself and set your classes to use that channel by default.
For example bullets should be in a bullet channel where it’s impossible for bullets to collide with each other.

You can also change a Blueprint’s collision channel on pool’s begin/end play events.

Egg on my face, I had my custom collision channel overlapping itself by accident. :o

Another question: Let’s say I have a blueprint that is part of a pool. If I have a child actor attached to that pooled BP (inside the components tab, not scripted) does that effect performance in any way? In other words if I have a pool of 10 blueprints and each one includes a child actor does that break the pooling system?

They should function normally, just don’t add pool components to the child actors that are the same type of pool they are spawned from.

Right, otherwise we get an infinite loop situation, correct?

Not always, you just make it possible to happen, so it’s good practice to just not make it possible to happen :slight_smile:

Hi ,

Sorry for yet another question, your patience while I sort this out as a BP newbie is really appreciated so far! (hopefully all this helps other people as well)

I am using a shared pool to hold different level parts for my endless runner (see attached) as each part has different enemies, things to avoid etc.
Right now the shared pool uses all available actors in a class then moves to the next class in the list and repeats itself.
I would like it to pick an actor from a template class in the shared pool list at random, is that possible? Am I using/thinking about shared pools completely wrong? Should I just create multiple pools, one for each level part BP and then do a randomization before the spawn nodes?

sharedpool.png

I should also mention, just in case, that I have a level part base class (parent is your pool actor) and all my other level parts extend from that base class. Not sure if that makes things better or worse in this case. Hierarchy looks something like this:

Pool Actor
– BP_Level_Part_base
---- BP_level_Part_variation1
---- BP_level_Part_variation2
…etc

If you want to return a random LevelPart you should make a “switch on int” node with a random int node attached, then call “spawn from shared pool” node using a different class for each node depending of value given by your random int node.

If random returns <= 1 spawn LevelPart_Base, If random == 2 spawn LevelPart_XX, etc.
You can do that in blueprint graph.

That seems to have done the trick, thank you. (my preliminary version of spaghetti BP attached for anyone following along).
Follow up question: Is there a performance gain to be had using a shared pool and randomizing the class it spawns versus having multiple pools each holding one type of class? Maybe I’m not entirely sure what the main objective of a shared pool would be?

Unrelated but curious: Can each level part that is part of the shared level parts pool have it’s own child pool of actors that are **not **shared with the parent pool? Put another way can a pooled actor have it’s own child pool? (not sharing any pooled actors btw them of course, don’t want an infinite loop situation)

I do not recommend adding pool components to pooled actors, it’s like stepping on eggs.

A Shared Pool Component exists simply to pack groups of memory together where it makes sense.
For each class in a shared pool is one less Pool Component you have to attach somewhere else.

ha, that’s what I figured. Will avoid pooling actors into pooled actors. Or breaking eggs :wink:

Thanks for the clarification on shared pools, seems like I’m on the right track. Appreciate all the help so far!

Hi

Any idea when the 4.23 version of the plugin is going to be released ?

Bumping this- How long before we get the updated version of the plugin for the newly released 4.23 ?

I am doing this today.
Marketplace team’s review process I can’t tell you how long they take, it’s random.

Thanks for submitting.Great plugin ,worked wonders on my scene

I copied projects to UE4.24.1. Objects pool works fine when I play in editor. But when I play in stand alone game, actors in pools are not spawned.
I packaged a project. It seem object pool works normally in a packed game.

I am having the same issues as skydashstudios. Hopefully this will be fixed or we will get some reponse soon.

I don’t know about standalone issues.
My focus is to keep it working on Editor and packaged builds.

Running on standalone mode adds a lot of weird behavior, too many to count.

Hi there, I have two weapons that shoot spawned projectile actor BPs, one that is static in the level (ground gun) and one that is from a spawned actor (not pooled) - The ground gun works fine but the one on the hand gun doesn’t spawn the actors. I am using object pools (not shared object pools) - What am I doing wrong. I have the same issue for score point widgets… (ue4.24). please let me know the correct setup.

You probably didn’t initialize instances on your spawned Actor neither enabled pooling on demand in project settings.