Why does unreal engine destroys instances and spawn new with new names on each compile? Is it possible to avoid that or could instances always be generated from number 1?
Also during compile there seems like there are multiple instances of one blueprint. Output log shows something like ActorName_C0 , ActorName_C5 and each is instanced 3 times and spawns Actor with incremented display name (ActorName_C0 spawns ActorName1. ActorName2, ActorName3 and last generated is visible in outliner).
One thing regarding child components, each time i click on node Add Child Actor Component warning Class.none pops up.
That is fine for me. But i still dont understand why Blueprint executes construction script three times. If i just do Print String it executes 3 times.
As for Actors, when i insert them to the Scene, parent Actor and first child actors names are okay, but descendants always seem to be generated from scratch, and numbers are going up each time i press compile.
There is also some unusual thing happening that sometimes compiling blueprint takes some disk space. I tried Garbage Collection and Destroying Actor but it is not helping.
Maybe i don’t understand properly how it is working or doing this wrong way.
But i still dont understand why Blueprint executes construction script three times.
well, Construction is probably not what you want to do, you will very rarely need to use Construction Script for whatever it is you are doing.
Without knowing what you are trying to do, though, it’s hard to make a suggestion. The names of the actors aren’t really relevant to anything other than being able to print them in debug logs and then you can relate them to something in the world.
Blockquote well, Construction is probably not what you want to do, you will very rarely need to use Construction Script for whatever it is you are doing.
I am creating procedural meshes. But whatever i do, for example just print Hello to output in new blueprint it will be printed 3 times. In my case 600 meshes generated 3 times, then sometimes there are 2 or 3 blueprint instances so everything is generated 6 or 9 times.
Also for what you need this info? Or is it just bothering you that it’s not starting from 0 like an Array does?
It’s bothering me that it is slowly taking my disk space everytime after compile. Probably that is how child actor component works, generating new each compile.
I think we need some clarification as to what exactly you are doing, and what exactly the problem that you’re experiencing is, because I totally do not understand how the last message (disk space) relates to the stated problem (destroys instances and spawns new).
To discuss Constructor briefly, When you’re doing something in Constructor, you’ll have that done every time the object is constructed – if it’s something that’s defined in a level or referenced in other inlevel objects, when it loads in the editor world, when you play in editor, when you spawn a new one, etc.
I’m pretty sure that when you compile a blueprint, all instances of that that are presently loaded are destroyed and re-created. So, when you compile the blueprint, you would see the Constructor fire for at the very least, the blueprint’s default object, as well as any currently existing instances of it in the world.
And to expand your middle sentence - construction script will also run on every frame if you move/rotate/scale in the Editor
And once in the Game when you Construct it
But how should that hold any info and take out disk space?
If you run something in Construction Script and it re-does the code on and on - actually the Instances are destroyed and replaced with new ones (if you make a big XY floor from multiple planes on construction it will start to lag due to destroying and re-creating the instances while moving the object around in the Editor)
Same about arrays and references - those are resetted whenever the construction script starts the work again
So what should actually leave such a significant mark on the HDD that you should feel loss of the available memory?
Maybe I was not clear enough because i am new to this and usually not good at explaining
So i put a lot of logic in construction script which probably should not be there. I have one actor that contains three child actors of one class which contains two more child actors which contains dynamically added child actors. Probably completely wrong way of doing hierarchy of actors but it works sort of. What was bothering me is that compile times were too long and output log was showing lots of messages similar to this
LogActorComponent: RegisterComponentWithWorld: (/Engine/Transient.World_4:PersistentLevel.DESTROYED_BP_Ring_C_CHILDACTOR_203.DefaultSceneRoot) Trying to register component with IsValid() == false. Aborting.
And now i have moved logic that was executed in construction script to function which is called from editor. Compile times faster but still getting messages
And it is weird that there is so many child actors when there are 6 of those class.
Also when executing print string in construction script it is executed also more times than it should be
and there is more than in this picture.
Regarding disk space, during usage of unreal editor and compiling these actors was lowering it and also it is adding more and more objects even there is not that much created. Turning off editor recovers some disk space and after restarting it recovers fully. So when i turn on pc i have 30 gb of free space, using unreal editor takes 10 gb and then if im using it for hours it can go to 2,3 gb of free space. I am using virtual textures but turning off did not change much. After restarting it goes back to 30 gb.
Ahhh … probably most likely you don’t have enough memory. You’re likely using a windows swapfile that is setup to grow and contract as necessary. Or it’s just some unreal temp files… but i’m guessing you probably don’t have enough memory. So your system is making up for it by extending a swap file.
If you’re getting errors like that, you’re doing something very wrong. Without knowing what you’re doing, though, it’s hard to say what you’re doing wrong.
So i have one blueprint which has 3 child actor components. These components are all same class (lets say class_1) and have set values. In blueprint class_1 there are two child actors of another class(class_2) and in construction script they are set to these values. Construction script casts these child actors to function from class_2 which spawns number of child actor components that are class_3.
As i showed that construction script is executed at least 3 times, which was happening to me even on empty blueprint, in this case everything is executed multiple times but end result is okay since other actors are destroyed but it seems like they are not.
Probably there is a better way to create a tree of actors but i am not aware of it.
well, there’s probably a better way to structure whatever it is. “tree of actors” is usually not a necessary thing, as far as I’ve ever encountered. ChildActor is very rarely used.
But then again, maybe your use case is something way outside of what most of us do