Download

Running scripts when making a level before runtime

I want to be able to run scripts when creating the level in the editor before running the game so these scripts would be only for before running the game or to be more clear before entering a level (for the instance of creating it randomly in the game like clicking generate level in the game it will generate it and then the player can enter it )

1- is there any way to achieve the above? (running a script during making a level)

to be more clear i am creating a modular level building system. i am currently using add child actor and it does work to some extent but
is there any other way to run a script say spawning the next piece of level when we want say by making a bool set to true inside the view port for example i give it the spec i want and i make “create” (a bool exposed to the view port) set to true and so the script runs and makes what i wanted it to (off course i could easily achieve the run code with construction script using a branch but i wouldn’t be able to spawn any actor with it so it would be useless)

i should state that all the process i am trying to achieve is before run time when i am making the level. After the level is made the scripts will be deactivated and the level will be there as if i have placed everything manually in their places

2- is there a work around for what i want to achieve?

3- on the basis of continuing my current solution how much will adding child actor components each with there own customized setting effect performance in comparison to having each of those child actors separate actors in the game ?

i have edited the above from my comment found here: Why can't I spawn actors from within construction scripts? - UE4 AnswerHub

oh and one more thing i can already see having more prolems with using construction script as my main way of runnig scripts since each time it runs it runs as if it had not been run before and anything done in the previous run of the construction script would be obsolete i might be able to workaround it but it is clearly not there for this kind of stuff and there must be some script that is! so i would be realy interested in knowing about it

if there is a way of running a script via c++ please share since all i currently need is an execution pin that i can call during developing my level or anytime actually! so it shouldn’t be that hard to bring that from c++ to blueprint so please share i have created the fundementals of my system and am desperate at tis point so if your reading this and have any idea that could help please share!!!

thanks in advance!!

up :smiley:

i realy need help construction script is unpredictable and i have no way of controllinf it without completley stopping it i need some kind of script running system in editor

thanks in advance

OK so i actually found out that UE4 has a built in functionality for what i wanted It’s called blutility (if i am spelling it correctly)

Thats 40 bucks that’l stay in my pocket :))

Is there any Way to edit the headline? i was hoping to write solved on it so if anyone was looking for something similiar they would know where to look

i actualy didn’t find about it’s existence anywhere online but just by being curious about the globaleditorutilitybase class and after fiddling with it i searched the web and found this forum post

which gives a very simple tut on it

hope others struggling with this matter will find it too

cheers