[Plugin] Object Pool Component

From your pooled projectile you can use a node “Get Projectile Movement Component”…
It’s there you change runtime values, if you change runtime values of a “Pooled Projectile” component at runtime it won’t work because it caches values to initialize the movement component of the projectile.

The “Pooled Projectile” component is a box for the default projectile component that cannot be pooled.

[USER=“434”] XaVIeR[/USER]
​​​​​​​Lifesaver :slight_smile:

Hello there guys! Joining here the fun with me own issue, please see the video pool not working - YouTube

My projectiles for some reason sometimes work properly and sometimes don’t… sometimes they stop in place and disappear after a few seconds or disappear way too early (they are supposed to almost reach the edge of the screen)
Here’s my code pretty much, I’d like to believe I did it correctly but I am not sure, let me know if I am missing anything.
https://gyazo.com/d903c68b55136077cb35e4de6b7dde27
https://gyazo.com/271bd4c3b879a3f1de79325b6edcdc8b

Thanks!

See demo project and how custom collision presets are used there.
Misconfigured collision settings can cause undesired behavior with pooled actors.

https://www.unrealengine.com/en-US/b…sion-filtering

Ey thanks for your reply, I wanted to see the demos but all the links I found both on market and here are all expired :frowning: could we get new ones? Screenshot - 1536c192bf543409cdcdd38607e2bc09 - Gyazo

I upload new files when I get back home.

Thanks!
Anyway I managed to figure it out, I actually forgot to turn off gravity so the projectiles were colliding with floor and I was also using a “do once” node from my previous code, now it all works great! Love your plugin cheers :slight_smile:

I have no idea how or why marketplace page reverted to show the 4.20 / 4.21 demo projects.
I edited page again to show links to 4.23 ~ 4.25 folders.

Hey, I’ve been using the object pooling component for a while now and not sure if it’s something specific to me but there’s an issue where OwningPool is always nullptr. There are places in PooledActor that seem to reference this but don’t check if there is a nullptr.

Also in the function USharedObjectPool::BeginDeferredSpawnFromPool in OBJPool.cpp this owning pool is always set to nullptr.

I’m not sure when this change was made, but not too long ago I didn’t have this issue. I’d say at least maybe 2 - 3 months ago.

I am not experiencing that, do you have a stack trace log to give me some clue of when/where that’s happening?

C++ code or BP node?

Interesting :confused:

I’m seeing this happen using C++ BeginDeferredSpawnFromPool and when using the spawn from shared pool node in Blueprints.

Attached is the full stack trace from UE4 crash log.

And this is what Visual Studio output when I was debugging.


Exception thrown: read access violation.
this->**OwningPool** was nullptr.

Oh okay.
When using a shared pool, the “outer” is:



yourPoolActor->OwningPool = nullptr;
yourPoolActor->SharedPool = *this;


OwningPool ptr should not be accessed from your code when outer is a SharedPool.
Instead of using GetOwningPool() you should as well use GetSharedPool() in that case.


  • I will add a patch to prevent a null access violation there.

Problem fixed… Unfortunately it’s weekend, we have to wait for epic review ^^

Hey that’s great to hear!

However I’m not accessing Owning pool in any of my code at the moment, Blueprint or C++.

That exception is being triggered in PooledActor.cpp 119 where it’s doing the following check:


if (OwningPool->ReinitializeInstances) 

Seems like there is an issue with the following logic which is supposed to prevent the function from performing the spawn at the beginning of the function.


if ((!OwningPool||!OwningPool->IsValidLowLevelFast())&&(!SharedPool||!SharedPool->IsValidLowLevelFast())) {
UE_LOG(LogTemp,Warning,TEXT("{Pool}:: %s"),TEXT("Actor trying to spawn from Pool, but Owning Pool Component is invalid!"));
return;}

Because I don’t see this warning message and breakpoints aren’t reaching here either :confused:

I think what you want to do is an OR if there is some logic that requires OwningPool to have a value? Or maybe a change so that OwningPool isn’t used and shared pool is used instead if there is no owning pool, as it seems to not be set for an pooled actor in a shared pool.

This is just from what I’m seeing. Sorry if overstepping any bounds or not understanding something.

I actually didn’t check pointer on line 119.
This happened after changing settings from project settings to pool component.

Changing settings from project settings to pool component??

This:
https://forums.unrealengine.com/unreal-engine/marketplace/104929-plugin-object-pool-component?p=1785709#post1785709

Epic already published the fix to marketplace, new binaries can be downloaded.

Ahhhhhhhhhh ok. I did notice that there was no properties for the plugin in project settings anymore.

And thanks! I will update and check it out now!

Oddly the update didn’t seem to work I’m afraid :frowning:

The crash log is the same pointing to PooledActor.cpp 119. Which I don’t understand as I can see the change you made :confused:

This doesn’t happen for you at all does it when using a shared pool?

Could be the case that something unique is happening on my side probably.

Are you on Unreal 4.25?

  • I will create a fresh new project to see if I can make the crash happen on me…