Tuesday, July 28, 2015

Unreal Engine Experiments: Prototype Menu System v1.4.2 Update

Hey, I'm back with another quick update for my Prototype UMG Menu system. This update replaces the placeholder 'Load Game Button' with a working 'Continue Button', that loads the last played level from it's starting point. A new map has been added to demonstrate this feature and you can switch between the maps in-game using '1' and '2' keys. 

The button will be disabled when you first load the project. But once you load any of the levels, you'll notice that the 'Continue Button' will be enabled when you return to your Main Menu for the next time. But for this feature to work in your own custom projects, you will need to add the level names data to a new array in the Game Instance blueprint, and make some changes to the save game settings as shown later on in the post. So let's get down to the details about the changes.

Update 4.2

- Continue Button to load the last played level from the Main Menu
- Current Version: 1.4.2
- Optimized for Unreal Engine v4.7.6

Listed below are the changes to the different blueprints in detail:
  • As you can see in the screenshot, three new variables are added to the Game Instance blueprint. Some changes have been made to the logic behind loading levels, in order to incorporate the data necessary for the Continue button. If you're adding more maps or wish to add this to your own project, you will need to populate the 'MapNameArray' with your map names. This includes the Main Menu map name as well, which needs to be stored in index '0' of the array.
  • The 'SaveSettings' function in the Game Instance blueprint now saves the level index necessary for the 'Continue Button' as well.
  • Some extra text information displayed using the Game Screen Widget. Not necessary though.
  • New code in the Player Controller blueprint to tell the game instance to load new levels based on the player inputs.
  • Add the following code in the Main Menu Widget to facilitate the working of the Continue Button.
  • The following code saves the data regarding the current level index, when the player exits from a game level to the main menu or the desktop.

That's all for this update. As always, feel free to grab the source code at: https://github.com/Stormrage256/UMGMenuSystem