Why is this construction event killing my framerate?

I have a blueprint actor, it only exists as a blueprint (no instances exist in any level)

Take note of the FPS change at the top just from plgging it in and compiling.


So what ‘seems’ to be happening is that this code gets executed extremely many times per second, which is odd.

If I replace that code with this
24-07-39
and compile, it prints ‘Hello’ 3 times and that’s it.

This is how it gets spawned

I have another actor that spawns the aforementioned one and this is how it does it, this is the only existing reference to the actor.
24-07-37
And currently this can only be called manually from the editor, which during the above images I had not done, no instances were spawned.

I completely do not understand what the hell is going on here, and construction script seems extremely poorly documented. Or is at least documented in a way I don’t understand, but I am sure I do understand the first sentence:

The Construction Script runs following the Components list when an instance of a Blueprint Class is created.

So why is this code executing when no instance exists? And why does it keep repeating infinitely like a while true loop on steroids?

And for that matter why does it execute not just when I place an actor in the level (create an instance) but 3 times when I compile it and 2 times whenever I move that actor around as well? My understanding was that it should execuse once while the instance is being created.

When you move an actor around in the level, the construction script can fire many times.

It looks like something else is loading this blueprint, or it’s part of a reference chain with other blueprints.

What do you see connected to this in the reference viewer? Also, what do you get if you right click on the blueprint asset and choose ‘size map’?

Projectile (Problematic bp)



Spawner (Only reference)

Whole spawn function

And as i said it only gets called manually through the editor there’s no automatic activation present for this event (yet). So as is this is only a reference, nothing more, it hasn’t spawned any instances and has no way of spawning instances except explicitly.

1 Like

You shouldn’t be spawing actors during the construction phase. Spawn actor is relegated for begin play or later in the life cycle of the actor.

The constructionscript fires before the world exists so there is no outer reference to spawn an actor.

Move the event execution to begin play

I am not spawning an actor during the construction phase though… I am making it self destruct during the construction phase if certain conditions aren’t met.

Not seeing the slowdown on my side after recreating the particle projectile

Perhaps you have some extra logic inside of the niagara particle system that is constantly updating, a user parameter set on tick or something?

2 Likes

Interesting, did you have the destroy actor node too? I noticed on my end if I remove that one it doesn’t freak out like in the op. (e.g. I already solved the problem, but the question remains of ‘why’ it is a problem)

The parent actor is a projectile with a limited life span

It doesn’t matter if it has a lifespan, you’re trying to replicate the scenario in the OP right?

To do that, the construction script needs to by default go down the ‘not valid’ route, and only become valid when it is spawned by another actor that sets the relevant variable to something as part of the spawning process.

Basically, just try a construction event that goes straight to destroy actor, see if it messes your engine up.

Recreated with defaulting to not valid

Absolutely no difference whatsoever.
Whatever is happening is probably due to the instructions withing the niagara system itself.

You clearly do not have the destroy actor node like i’ve told you twice in a row now…

Why would you skip a node when you’re trying to replicate a problem?

it does print string but doesn’t impact performance.

You can try this

Just set the owner when you fire the projectile. It seems to stop the print screen when projectiles are not present.

1 Like

That works, thanks a lot, i marked it as the solution but i’d still like to know why it happens in the first place.

Perhaps it has something to do with the fact that unreal pools particle systems and it is being triggered in the internal pool?.
Might be a bug.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.