regardin topic 1. what is funny is your pool projectipe has the boolean is homing projectile and the float homing projectile magnitude but without this one component “set homing target component” it will never home towards anything… would you ever consider “fixing” this or else no one will ever be able to use your object pool with homing projectilesm.m
Yes, I add to my to do list.
regarding # 2. I know how to make my blueprint expose on spawn lol(im not that much of a noob)… what I don’t know is how did you get your projectile to appear there in your blueprint instead of casting to it like you where doing before(you just showed the photo showing your exposed variables but you didnt show how to expose them)… I also checked your demo project, and you are still using the old way - you spawn actor from pool without showing any expose on spawn options…
Also for #3, it is in the spawn options that I am enabling and disabling physics…
I apologize, I know for 10$ you are doing a hell of a lot but I just think some better explanations for semi-noobs for me would be optimal, especially as noobs start getting into serious development they will definetly need this plugin for performance… obrigado
here is a foto showing no expose on spawn options and the 2nd one with my original bp being spawned normally with the exposed options
On your Pool Component’s “Template Class” you have to set it to “NewPBullet1”, this is why you don’t see your exposed properties.
After you do that the spawn node will automatically cast and your exposed properties will show on node. If you need to cast then it’s wrong.
Check this on your Details panel, after I set the Template Class to my Blueprint class then I don’t need to cast anymore and the exposed properties show up on the node:
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/OBJPool_TemplateClass_zpsxirufsn4.png~original
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/OBJPool_Exposed_zps0tb6rrri.png~original
- so you added the pool component to the bullet’s bp(pool_bullethell2) itself AND the actor that is going to spawn the bullet from pool (in my case the character) I guess in your case the weapon… they both have the bp_projectile-pool (object pool component) in them as components???
I really don’t get it, it seems like the instructions from the 1st post and what you are doing here is completely different, or maybe im just completely lost LOL
No; the bullet is a class child of “PooledActor” which must be selected as a “Template Class” in the Pool Component.
The Pool Component is an OBJPool component class.
It isn’t working for you because you are making the Pool Component spawn the default “PooledActor” class which comes with the plugin instead of selecting your correct class child of a Pooled Actor to be the Template Class used by the Pool Component.
It’s very clearly explained in first post on the “How to use” section: [Plugin] Object Pool Component - Marketplace - Unreal Engine Forums
If you attach Pool Component to a PooledActor you’ll make an infinite loop and Unreal may crash.
Using “PooledActor” as Template Class does nothing, this is a base class and has no mesh; you simply have to create an Actor, set its parent to be PooledActor derivative then on Pool Component pick this Actor to be the “recipe” of the pool, this is what the Template Class param is for.
Hi, I would like to use this plugin in C++.
I created a PoolManager that dynamically generating UCharacterPool by custom character types.
There are 2 functions “PullActor” and “ReturnActor” in UCharacterPool. But PullActor is deprecared after 4.15.
How to pull a APooledCharacter from UCharacterPool in C++ now? Should I call “BeginDeferredSpawnFromPool” directly?
Another question: My Character animation is using Animation Blueprint. Is there any way to reset animation when pull from pool?
Yes, in this case you’d want to call the “Begin Deferred Spawn” function:
UObjectPool::BeginDeferredSpawnFromPool(const UObject* WorldContextObject, UObjectPool* ObjectPool, const FPoolSpawnOptions &SpawnOptions, const FTransform &SpawnTransform, ESpawnActorCollisionHandlingMethod CollisionHandlingOverride, AActor* Owner, const bool Reconstruct, bool &SpawnSuccessful)
After you’re done with the spawn process, you also have to call in C++ the “Finish Deferred Spawn” function to conclude the spawn process:
UObjectPool::FinishDeferredSpawnFromPool(APooledActor* Actor, const FTransform &SpawnTransform)
Both return a pointer to the spawned actor, but you should call the Finish one only after checking that the pointer from Begin is valid; after many collision checks the engine may decide to not spawn the Actor depending on your collision options and then the returned pointer may be invalid, in this case Actor->FinishSpawning(SpawnTransform); will not execute.
You can subscribe a function to the “On Pool Begin Play” and “On Pool End Play” events of your PooledActor, then in these subscribed functions set a param that is read by the AnimBlueprint which would make AnimState return to its default value.
The events are these in Pooled class:
/// Event called every time this Character is spawned from the Pool.
UPROPERTY(Category = "Object Pool", BlueprintAssignable)
FOBJP_PoolEvent OnPoolBeginPlay;
/// Event called every time this Character is sent back to the Pool.
UPROPERTY(Category = "Object Pool", BlueprintAssignable)
FOBJP_PoolEvent OnPoolEndPlay;
/// Event called every time this Character is spawned from the Pool.
UFUNCTION(Category = "Object Pool", BlueprintImplementableEvent)
void EVENT_OnPoolBeginPlay();
/// Event called every time this Character is sent back to the Pool.
UFUNCTION(Category = "Object Pool", BlueprintImplementableEvent)
void EVENT_OnPoolEndPlay();
Edit:
Those events are automatically executed, you don’t have to call any of them; just subscribe a function to them; example:
OnPoolBeginPlay.AddDynamic(this,&AMyPoolCharacter::ResetAnimations);
I’m having an issue when the projectile is spawned from the pool, it won’t move but if I spawn it from the traditional ‘Spawn Actor’, it moves as it should do. Is there an obvious step or call I should be making?
Issues like this is always due to the collision/physics settings you’re using when spawning your projectile.
Make sure you use correct physics settings on your spawn options.
Yeah, I fixed it by checking the ‘Reconstruct’ boolean. You say, “This results on expensive respawn operation and will affect performance”, how expensive? And how do I avoid using that option and make the projectile movement work?
A normal spawn actor, engine default, will take some impact on fps.
If you leave the reconstruct option turned off, that impact using the OBJ Pool is reduced by 70%~90%;
With that reconstruct option turned on, the OBJ Pool will reduce spawn impact by 40%~80%, so if you spawn a projectile every frame that would give your spawn function only 40% performance boost instead of ~90%.
If the projectile isn’t spawned every frame, that’s fine.
On construction script you can set the initial (exposed) velocity of the projectile, maybe that’s why yours don’t move, no speed set on spawn.
Also make sure you use the custom projectile component provided; the default projectile movement component will not work on object pools.
Cheers. I fixed the velocity issue. I used the custom projectile movement. Sorry for all these questions but needs must.
So, for any pool object, the standard Lifespan of the object should be set to zero and the set the Object Pool lifespan to whatever?
In your tutorial, you say that you can put an empty actor in to your level with the Pool component attached and how would I get a reference to that pool inside the NPC blueprint?
You simply get reference to empty actor then get its pool component; from there the component has a bunch of exposed functions including the custom spawn nodes.
This OBJ Pool plugin 1.3.5 has been updated to the Unreal 4.17 version;
Submitted to Marketplace staff.
Back again… [MENTION=434] XaVIeR[/MENTION]
LogBlueprint:Error: [Compiler BP_BaseWeapon_Projectile] Error COMPILER ERROR: failed building connection with '{ S} Pool Actor Reference is not compatible with BP Projectile Reference.' at Spawn Actor From Pool :: {S} Pool Actor
LogBlueprint:Error: [Compiler BP_BaseWeapon_Projectile] Error This blueprint (self) is not a BP_Projectile_C, therefore ' Target ' must have a connection.
LogBlueprint:Error: [Compiler BP_BaseWeapon_Projectile] Error Variable node Get Mesh uses an invalid target. It may depend on a node that is not connected to the execution chain, and got purged.
So BP Projectile inherits from OBJPoolActor, and the object (BP Projectile Pistol) I’m trying to spawn inherits from BP Projectile with the native parent class being OBJPoolActor. I’m attempting to get the mesh of the spawned BP Projectile Pistol to ignore the character it was spawned from (ignore actor etc.) but the compiler spits out an error that the link to the target mesh from the resulting spawned BP Projectile Pistol is not compatible with BP Projectile?
Annoyingly, these error only show up in packaged builds and even in packaged builds that succeed, the collision of these pool actors do not behave the same way they behaved in the editor version.
Edit: Yeah it won’t let links to ‘target’ variables, components etc. because it defaults to a BP Projectile reference.
Please send me a google drive link to download a sample project where you have these errors so I can debug them myself.
The gun should not be a pooled actor, it should just have a pool component attached which spawns bullets from the pool.
I won’t be able to give you my project, but when I’m not busy next week, I’ll try replicate the error in a blank project. The Pool component isn’t in the gun.
So, spawning BP Projectile Pistol wasn’t working correctly, but spawning BP Projectile Sniper and BP Projectile Shotgun were working - exact same execution chain etc. I’m using different pools for each ammo type; so I thought that it was the Pistol Pool component that was the issue: remade it and no, it didn’t effect anything. So, I just deleted BP Projectile Pistol and yes, it worked as it should have and is working. I’m guessing that when I was tweaking the Pistol Pool component, it somehow corrupted BP Projectile Pistol irreparably.
And…
LogBlueprint:Warning: ExposeOnSpawn ambiguity. Property 'StructProperty /Engine/Transient.REINST_BP_Projectile_C_231:InitialDirection', MetaData 'False', Flag 'True'
LogBlueprint:Warning: ExposeOnSpawn ambiguity. Property 'ObjectProperty /Engine/Transient.REINST_BP_Projectile_C_231:InstigatorController', MetaData 'False', Flag 'True'
LogBlueprint:Warning: ExposeOnSpawn ambiguity. Property 'ByteProperty /Engine/Transient.REINST_BP_Projectile_C_231:CollisionChannel', MetaData 'False', Flag 'True'
LogBlueprint:Warning: ExposeOnSpawn ambiguity. Property 'StructProperty /Engine/Transient.REINST_BP_Projectile_C_231:InitialDirection', MetaData 'False', Flag 'True'
LogBlueprint:Warning: ExposeOnSpawn ambiguity. Property 'ObjectProperty /Engine/Transient.REINST_BP_Projectile_C_231:InstigatorController', MetaData 'False', Flag 'True'
LogBlueprint:Warning: ExposeOnSpawn ambiguity. Property 'ByteProperty /Engine/Transient.REINST_BP_Projectile_C_231:CollisionChannel', MetaData 'False', Flag 'True'
LogBlueprint:Error: [Compiler BP_BaseWeapon_Projectile] Error COMPILER ERROR: failed building connection with '{ S} Pool Actor Reference is not compatible with BP Projectile Reference.' at Spawn Actor From Pool :: {S} Pool Actor
LogBlueprint:Error: [Compiler BP_BaseWeapon_Projectile] Error This blueprint (self) is not a BP_Projectile_C, therefore ' Target ' must have a connection.
LogBlueprint:Error: [Compiler BP_BaseWeapon_Projectile] Error Variable node Get Mesh uses an invalid target. It may depend on a node that is not connected to the execution chain, and got purged.
LogBlueprint:Warning: [Compiler BP_BaseWeapon_Projectile] Warning [0021.22] Compile of BP_BaseWeapon_Projectile failed. 3 Fatal Issue(s) 0 Warning(s) [in 15 ms] (/Game/GenericShooter/BlueprintLogic/Weapons/BP_BaseWeapon_Projectile.BP_BaseWeapon_Projectile)
LogBlueprint:Warning: [Compiler BP_BaseWeapon_Projectile] Warning [0021.22] Compile of BP_BaseWeapon_Projectile failed. 3 Fatal Issue(s) 1 Warning(s) [in 0 ms] (/Game/GenericShooter/BlueprintLogic/Weapons/BP_BaseWeapon_Projectile.BP_BaseWeapon_Projectile)
LogBlueprint:Warning: [Compiler BP_BaseWeapon_Projectile] Warning [0021.22] Compile of BP_BaseWeapon_Projectile failed. 3 Fatal Issue(s) 2 Warning(s) [in 0 ms] (/Game/GenericShooter/BlueprintLogic/Weapons/BP_BaseWeapon_Projectile.BP_BaseWeapon_Projectile)
It’s broken again except this time, the BP Projectile Shotgun isn’t working. Closed it down and opened it up to see if all errors were gone…
Unreal is still causing these blueprint corruptions in projects quite frequently for everyone;
The projects i’ve worked on they decided to base most development in code instead to avoid dealing with BP corruption on important gameplay features because of this. it’s usually a mix of redirectors going crazy + slow HDD write in critical situations.
So you don’t have any idea why this is happening? It works completely fine in the editor and when it is packaged it throws up the error and I do get a warning about
UATHelper: Packaging (Windows (64-bit)): Cook: LogInit:Display: LogTemp:Warning: {S}:: Initializing Object-Pool Plugin.