So, I’ve been trying to work on my C++ by working on Construction Script. I want a grid of blocks to be attached to the actor that’s calling it. However, when I move the actor, it spawns more actors without getting rid of the other actors from it’s last call. On top of that, when I delete the actor from the scene, the rest of the actors stay there.
I’ve tried parenting the spawned actors to the actor that calls it, but when I call destroy, they stay there.
Thank you.
You need to set Owner first in spawn parameters to make actor a child:
Keep in mind that in C++, function have no idea who executes them so they can get information whos Owner out of nowhere
Did you consider using child actor components? it allows to attach actors as components, you might find them easier to use
Thank you very much! I took a look at the Spawn Parameters and that helped. They don’t show up as children in the World Outliner window, but they are still deleted when the main actor is deleted/moved. However, I ran into another problem.
Sometimes, the Construction will add an extra block for some reason, and when I delete the original actor, it will be left over. It’s almost like the Construction accidentally fires an extra time.
UPDATE: So I used UE_LOG to monitor how many times Construction Script is firing, and it is definitely running twice on some updates. I even made sure I modified things precisely so it would only run once, yet it runs twice. It seems like this is a known bug and has been around for a while. When are we going to get a fix for this?