Level Blueprints
"Level Blueprints" in kemorig are not the same as Unreal's "Level Blueprints"! Don't confuse the two.
Level Blueprints allow you to create Blueprint logic for your kemorig levels. Just like with Avatar Blueprints, you can respond to various events and add arbitrary features to your level.
Adding a Level Blueprint to your Level
In the Content Browser, right click and create a Blueprint Class.
In the “Pick Parent Class” window that appears, search for “kemorig” and select KemorigLevelBlueprint.
Rename the new asset to a name of your choice, for example “MyLevel_Blueprint”.
Add it to the Level
Next, we need to add our Level Blueprint to the level itself. Otherwise, our Blueprint will not run!
Open your level, and drag your Level Blueprint from the Content Browser into the viewport. You can place it anywhere in the level.
Now your Level Blueprint will run and have access to kemorig events.
Built-In kemorig Events
Kemorig has a number of built-in events that may be useful for authoring logic.
To find them, open the your Level Blueprint’s Event Graph, right click, and search for “events”. Near the top you will find a category called “Kemorig Core Events”.
Called when an avatar is spawned.
Returns:
- AvatarName - Name of the avatar
Called when an avatar is de-spawned
NOTE: This is never called when testing in-editor!
Returns:
- AvatarName - Name of the avatar
Called when any solo interaction is played
Returns:
- InteractionName - Name of interaction that played
- InteractionState - Current state of the interaction
Called when any Stance change is played
Returns:
- StanceGroupName - Name of the Stance Group this Stance belongs to
- CurrentStanceName - Name of the Stance entered
- PreviousStanceName - Name of the Stance exited
- StanceGroupState - Current state of the Stance Group
Called when the user starts talking into their microphone
Called when the user stops talking into their microphone. This respects the user-configurable Talking Hold Time, which delays when they are considered not-talking
Called when a level begins
NOTE: LevelName will be empty when testing in-editor!
Returns:
- LevelName - Name of the level that is starting
- IsEditor - True if testing in-editor
Called when a Level is deactivated, during the swap to a new level. This will be called before LevelBegin on the incoming level. The level and its contents are still valid at the time this is called
NOTE: This is never called when testing in-editor!
Returns:
- LevelName - Name of the level that is being deactivated
Called when a Level swap begins. This is called when the incoming level begins loading, not when the swap itself takes place
NOTE: This is never called when testing in-editor!
Returns:
- IncomingLevelName - Name of the level that is being loaded
- OutgoingLevelName - Name of the current level that we are leaving
Note: Prefer “Level Begin” to “Begin Play”
Unreal Blueprints have a “Begin Play” node in the Event Graph by-default.
For Level Blueprints, I recommend deleting that node and using the kemorig-specific “Level Begin” event instead. This event runs slightly later than Begin Play, once the level and camera system are properly initialized.