Difficulty: Advanced
While the XANDRA Character Creator is a utility for creating blueprint characters in the Editor, this demo instead re-purposes the system for creating a player character directly within a game such as a RPG. It provides some basic blueprints that can be used as a starting point for doing this, but the rest is up to you.
The demo contains two scenes:
- 1. Lvl_CharacterCreator_InGame is the scene where the player creates their character.
- 2. Lvl_DemoGame is a level which loads the newly created character from the save file.
To run the demo from the start, run Lvl_CharacterCreator_InGame. When you’ve created a character, click Play. The blueprints will save your character, load the next scene, and then load your character from the save file.
You’ll need to do additional blueprint work to adapt this to your game’s save file format if you already have one.
As a quick summary of how this is set up:
- If you open Lvl Demo Game and click Window -> World settings you will see that the Game Mode Override is set to BP DemoGameMode.
- BP DemoGameMode defines the default Pawn as BP DemoPlayerPawn
- BP Demo Player Pawn loads the save game in LoadConfigFromGameSave to make the character appearance into what the player created when the game is loaded.
- It also has some useful methods to change the character appearance in runtime – see the events in the Event Graph.
- If you place the BP_UISpawner_InGame blueprint into a scene, it will spawn the in-game character creator including the cameras at the location where you have placed that blueprint. The CameraManager is a variable in WBP_UI_Common if you need to change the camera’s location directly during runtime.
- Inside the BP_DemoSaveGame blueprint, the CharacterAppearanceConfig variable stores a map of string field names to values that represents the appearance of the character. This is the data that is used to save and load the character appearance.
- In the WBP_UI_Common blueprint the method Load Character in Demo Level has a variable ‘Demo Level Name’ that changes which level is loaded when you’re using the in-game character creator demo.