Xandra Character Creator can be used as a
Player Avatar maker within your game at runtime.
We have created an example to show you how to do this.
To begin, you must start with with the correct demo scene. The (L_CharacterCreator_InGame map)
L_CharacterCreator_InGame is a demo for runtime player character creation.
To see how it works, run Lvl_CharacterCreator_InGame. When you’ve created a character, click Play. A gameplay scene will be loaded, and your created character will be used 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.
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.
- To see this example, open BP_DemoPlayerPawn and look at the input events for keyboard button presses.
- Pressing J and K is an example that changes the body type
- Pressing I is an example that changes the ‘Full outfit’ (i.e. a dress)
- Pressing L is an example that changes the hairstyle
- Pressing P is an example that changes the hair color.
- The row name here must exactly match the row name in the Data Table for the wardrobe item being set.
- These examples also save the appearance to the example Save Game.
- Press O is a different type of example that directly sets the mesh to something that does not exist in wardrobe items.
- This might be useful for changing things like the Player’s clothing without changing their save file appearance, for example, or if you otherwise want to make changes to the character appearance that do not save to the Save Game.
- 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.