I want to run a function, in editor, or when building the level, to set the default value of a variable on the game mode, or maybe to fill a data table, don’t know what is best, nor what is possible.
To elaborate a little, my game is a vertical scroller, I made an Actor responsible for calling events when the player progress (distance covered at a fixed speed), that events can spawn an enemy or finish the game at desired X location. Currently on begin play, my game mode creates an array of Actors using get all actors of that class, after that, every frame it checks if the player as passed on of that actors, if so, it fires the actors event and removes the actor ref from the array.
But I think checking every frame an array of actors can be demanding, so when creating the array I’ll sort it, based on actors distance relative to the player start, and after that I’ll only need to check the first actor of the array, firing the event if the player passes it, and removing the first actor from the array.
But even with that solution, the part where I get all actors and them sort all of them can be done before the game even starts, but I don’t know how.
I know about Blueprint Editor Utility, and Blueprint Editor Utility widget, but can I use that to set the default value of the array in the Game Mode? Can that array be a read only after the game starts? Using a variable to store imutable data seems wrong, should I use other thing? like a data table?
Also could i do that asynchronous on the firsts seconds of the game?
Obs.: Sorry for my bad english, hope I made it clear. Thank you for the help.