I place my interactable objects in the game world, in the editor. Therefore, can I do some basic logic, for example, add them to a manager, in the construction script? Will it cook and go into the game build?
I’m not sure if I follow exactly what you’re asking, but yes construction script runs in built versions of the game. It runs anytime the instance of an actor is updated.
The function you see, which I posted, can I call that in the construction script?
I’m not sure it does…
I think it runs once during packaging, then no more.
If you want to, for instance, change things each time the level is loaded using construction. I don’t think it will work in a packaged game. You need to put that logic on begin play.
Construction is (or at least used to be) editor only. So essentially if you package it wont run…
I will test it and get back to you gentlemen. BTW, I am using UE4.27.2.
Wow you’re making me question everything I know. I’m sure you’re right, and admittedly I haven’t done it in a long time but it must be a serious Mandela effect, I could swear I’ve built procedural layouts within the construction script. But there you go, the more you learn the less you know!
I’m waiting for the results of the @DiliupG experiment
User construction script runs during gameplay for dynamically spawned actor, but only in editor for placed actors.
What you said is true: the construction script does run in the editor and in the packed game, but not all code in the construction script. The GetAllActorsOfClass does not run because there is no guarantee that all other world actors are available, and in my case, where I use sublevel streaming, it does not happen. But all the code that applies to the actor itself does run, like raycasting, detecting the ground, setting the tags etc.
Right, but I think that ran when you packaged. The ground didn’t move since then, for instance.
Sorry, my mistake in writing. The code does run but will not give a correct output because all sublevels may not be loaded and objects not initialized. So, the code will not return all objects, maybe some.
What do you say? Is that how it will work or is it different?