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
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.
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.
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.
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.
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)
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.