Load / Save Icons
Load / Save Icons
The user will need to prepare the data icon and apply the update to all affected actors. The explanation below
is an example on how the user can load the data and call the appropriate function on the world map.
Setup GameInstance
All data will be loaded from the game instance and thus the "BP_MapNav_GameInstance" will
need to be parented with your own game instance. Skip this if you havent yet created your own game instance.
PreLoad level placed Actors
Actor Preparation
When the game start(level map load), all actors possessing the "BP_WidgetComponentIcon" component automatically
execute their BeginPlay event. This event retrieves the actor's icon data from the game instance
and assigns a tag "IconTag" to the actor.
Widget World Map
Upon creation, the WBP_WorldMap widget iterates through all actors having the tag "IconTag."
Based on the retrieved icon data, the corresponding icon button is loaded and displayed
on the world map.
Side Note 1
- When hitting the play button, the event BeginPlay of a bp order sequence will matter when loading variables.
- Order Example: Widget Component(from placed actor) begin play will always execute before a Character begin play.
-
Example: If we try to get the variable "WBP_WorldMap" of the main character from an actor's
"BP_WidgetComponentIcon" beginplay, it will output null since the begin play of the main character havent yet execute
to create the widget world map.
Side Note 2
- It might be needed to add some check condition during the function timers to prevent any conflict.
- Especially for the event "LoopLoadCustomMarker" in WBP_WorldMap and WBP_DungeonMap.
- If the timer function is still running and the user add a new custom marker, this might mess up
the index loop.
- A quick fix will be to use some check boolean to prevent new custom marker or to load them through
a loading screen.
- You can also replace the function timer with a ForEach but this is recommended only if don't have
a large amount of icon (or with a limit a custom marker to be made as well)
- Use the node "StartProfiling" and "EndProfiling" to test the execution time of your ForEach.
Load Spawned Actors
Adding icon to spawn actors.
-
The IconData will be loaded from the event begin of the bp component "BP_WidgetComponentIcon" if the
IconID is found from it game instance.
-
Use the event
AddComponentIcon
to apply the update on the world map.
How To Save
Use the template save example from the main character "BP_Cobaye". You can use that example to move that implementation
to your save manager system.
-
Just press T to save the progress
-
Example: