This Character Blueprint shows you how to use the following components of the pack and shows you, with intermediate Blueprint knowledge, how to implement all relevant logic into your own character. Also, there are some variables and functions to help you work with BP_Character
in Unreal Editor viewport as well as on save game content.
There are three components added to the character:
To setup interaction with the BP_CharacterCustomization component, the character implements the Character Customization Interface
in its Class Settings. It has 9 functions. The descriptions are order by their business logic.
Customization Profile
Get Customization Profile
Set Customization Profile
Character
Get Character Customization Component
BP_CharacterCustomization
component to pass around various functionality.Get Character Editor Component
BP_CharacterEditor
component, when used. This can return nothing if the character does not use that component.Add Skeletal Mesh Component
AddSkeletalMeshComponent
directly on this character, since adding a component from within a Blueprint component is not allowed and must be called directly on the owning actor. Used for Skeletal CDAs.Add Static Mesh Component
AddStaticMeshComponent
. Used for Static CDAs.Add Groom Component
AddGroomComponent
. Used for Groom CDAs.Destroy Component
DestroyComponent
for the same reason as for Add...Component
.LODs
Get LODSync Component
must return the LODSync component, when used. This can return nothing if the character does not use that component.There are various variables and functions exposed to the Actor Details, that you can control if you place BP_Character in the Unreal Editor viewport.
In this chapter, variables that are passed directly to the BP_CharacterCustomization component are marked with (CC) and will be explained here from user perspective to get you started and in the component’s chapter from technical perspective.
An exception is “Customization Profile (CC-Initialize)”, which is passed indirectly by calling BP_CharacterCustomization > Initialize with Initialization Behavior “Use Current Profile” or "Open Character Editor with Customization Profile", which in turn gets this variable from BP_Character through the Character Customization Interface
> Get Customization Profile
.
There is a small caveat as of now: bone transforms of our Anim Blueprints (e.g. size, age and foot transforms) as well as Anim Dynamics (e.g. the beard from Preset Profile 6 “Tyler”) will not update correctly at this stage in Blueprint, because calling this function seems to be different than triggering Construction Script via Refresh checkbox or other variable changes.
Until we find a solution on how to trigger the Construction Script properly from within Blueprint (no Unreal Engine function available, yet) or until maybe YOU 😉 have some advice our recommended workaround is to load the profile and then hit the Refresh checkbox or make changes to the customization profile to forcefully trigger the Construction Script.
In Construction Script the Refresh variable is reset to be triggered again and again in Actor Details panel, acting as a button. All the variables from above marked with “(CC)” are passed directly to the BP_CharacterCustomization component.
In standalone (non-network) mode the Construction Script initializes BP_CharacterCustomization and updates “Available Profile Names”, so you can see directly what you are modifying in the Actor Details panel.
Actually, we should check if the game is not running, i.e., constructing in editor, to use this initialization only for modifying the details panel. Since we do not have such a Blueprint node by default, use "IsStandalone" instead, meaning the character is either in Editor, PIE or in a running Standalone Game.
This way we can at least block this initialization in multiplayer, where "IsStandalone" is false, to avoid duplicated initialization and potentially unwanted side effects.
Of course, you could change the Initialization Behavior but initializing the character with an open character editor in Construction Script has no effect, since widgets can only be created while the game is running.
Since the Replication Update, the whole process is divided in multiple steps and depends on if replication is enabled or not. If the Character Editor is used in standalone, the initialization almost behaves like before the update from the user’s perspective. If replication is enabled it may feel a tiny bit different, because of network delay and two manual delays, that are explained in BP_CharacterCustomization component.
For now, focusing on the BP_Character itself, you need to call Character Customization’s Function: Initialize From Character Begin Play and connect an Initialization Behavior, a Profile to Load and Character Editor’s Function: Initialize From Character Begin Play to the delegate pin of the first function, as well as a custom event for your own logic at the second nodes’ delegate pin.
At the delegate pins, you see on which network target / in which situation they are called, so be aware that e.g., the BP_CharacterCustomization client-side of a replicating NPC does not call “On Initialized” – only the server instance of that NPC does. This is necessary because in this case the client-side NPC only pre-initializes itself, because it is completed by the client players’ request for the NPCs’ customization profile.
Previously we were initializing the BP_CharacterCustomization component and the (optional) BP_CharacterEditor component on a player-controlled BP_Character. Our showcase map had set the characters Initialization Behavior to “Use Current Profile”, thus not showing the editor at Begin Play.
You had to press [C] to show it.
Besides that, right below the Begin Play section there are the character controls, which are further described in In-game Controls > Implementation Details.