The Time of Day Spawner, BP_TimeOfDay_Spawner, in the Blueprints/Utilities/ folder can be used to spawn Blueprints and Niagara Systems through the day. To use just drag and drop the blueprint into your level where you want the spawn to appear.
Included with the Spawner you will find 3 niagara systems (Fireflies, Colorflies, and Butterflies) a well as the Sphere (base spawner), Unreal Coin, Cupcake, and Cube blueprint spawner examples. See the base spawner to see how the impulse is added to launch the meshes in the air when they spawn. These examples can be found in the Demo/ folder.
The spawner gives you two different ways to control the spawning of your actors, either at different times of the day (Morning, Afternoon, Evening), or within specific time windows (between 9:21 pm and 1:29 am).
SwitchType Configure which time mode you want your spawner to use.
You can only use one type per spawner, so if you want to use both in the same location you would just create a second spawner for the other switch type.
After deciding on your SwitchType you will use the configuration variables in either the “Time of Day Switch” section or the “Fixed Time Switch” section. Inside these sections you will have the sub-section for either Actors or Niagara Systems, if you are spawning another blueprint you will use the Actors section. If you would like to play a Niagara System like the included Fireflies, Colorflies, and Butterfly VFX you would define this in the NiagaraSystems subsection.
TimeOfDayActors Each element you add to this map will be for the time of day, this is what you will select in the Key of each element. The value is an array containing the criteria for the actors you want to spawn. Even though you are limited to a single element for each time of day, you can still spawn multiple actors at each time of day by adding multiple items to the array in the TimeOfDayActors map value.
Since the SpawnActor array is used in both switch type modes we will go over the different values you can set inside it later in this chapter.
TimeOfDayNiagaraSystems You can play one different Niagara System at a time, per spawner. For time of day mode each element we add to the TimeOfDayNiagaraSystems map will let us define the time of day as the key, and the value is the Niagara System to play.
FixedTimeActors Each element you add to this map is how you define which actors to spawn at different windows. The key in each element is our SpawnActor structure, and we will go over these settings in a minute. The value is another structure which is how we define the start and end point for our schedule window.
FixedTimeNiagaraSystems The key in each element added to this map is the niagara system you want to play. The value is another structure which is how we define the start and end point for our schedule window.
You may be wondering why it is called FixedTime if we are using a time window. This is because if time is moving too fast in your level you may not land on the exact minute or hour if we were using a true fixed point. This means nothing would even have a chance to spawn. To mitigate this we instead define a time window with both a start and end point. One thing you do have to make sure you always do is define your end point and not just the start point, and make sure you give enough between your start and end point to account for the speed of time in your project.
The SpawnActor structure is found in both Time of Day and Fixed Time mode for the actor spawner configuration map. Below is a breakdown of the variables found in the SpawnActor structure.
ActorBlueprint This is the blueprint you want to spawn, it can be anything, but keep in mind there is currently no way to define any input variables you may have marked as expose on spawn for the actor blueprint you select.To get around this you would need to either create another blueprint that uses a child actor with these variable already set, or spawn the actual blueprint from within this helper blueprint with your custom values on begin play.
MaxActors This is the max number of this actor blueprint you want this spawner to spawn.
GlobalMax? If set to true the MaxActors value you entered will be treated as a global max, accounting for all of the actors in your level. If set to false MaxActors will be treated as a max of the actors just created by this individual spawner.
SpawnChance This is the chance of spawning the actor when it is time to spawn it. At 1 this is 100%. If you set this to 0.1 it will have a 10% chance to spawn, and if you set this to 0.9 it will have a 90% chance to spawn.
SpawnAllAtOnce? When the system determines that it is time to spawn something (after the chance roll) you can further control how many it spawns at once using this variable. If set to true it will spawn as many as it can based on the other settings you define related to MaxActors. If set to false it will only spawn one per time cycle.