Judicator
(Judicator)
August 24, 2015, 8:22am
7
First of all: LevelBlueprint for this is a bad place. The LevelBlueprint is not easy to be accessed by other Actors.
Better use the “GameState” class for this. You can always use “GetGameState” in your Widgets and access the Timer.
You can create your own GameState Blueprint Class and set it in the GameMode default classes.
In the GameState you can again use the BeginPlay Event and spawn the Timer Actor. Then you directly save the return value
of the SpawnNode to a Variable, so that you have the Reference you need. Then you can access it by getting the GameState,
casting it to your Custom GameState and accessing the variable.
You may also think about creating and saving the Widget in the GameState. Then you can pass the reference when creating the Widget.
Variables in widgets can be set to “Editable” and “Expose on Spawn” which will show them directly in the Create Widget node.
Same goes for Spawning Actors.
If I move the logic to Gamestate what happens when the race ends and the next level is loaded? Will it fire the logic, spawn BPs, etc, for every level that gets loaded?
Edit:
Ok, Gamestate fires the logic tied to BEGIN PLAY at game start and when a level is loaded, I suppose it does as well every time a level gets loaded.