How-To: Get the Building Blocks
Goal: obtain, in both audiences, every handle the other pages assume - the manager component, the current experience, and the ready state.
1. The experience manager component
It lives on the game state, so every lookup goes through the world's game state. There is no static accessor.
Get Game State -> Get Component By Class (Crimson Experience Manager Component). Guard the result with Is Valid - during travel the game state can be null for a frame.
2. The current experience
GetCurrentExperienceChecked() asserts when the experience is not fully loaded. Always gate it on IsExperienceLoaded().
Both IsExperienceLoaded and GetCurrentExperienceChecked are C++ only. From Blueprint, use Wait For Experience Ready instead - by the time it fires, the experience is loaded by definition. See How-To: Wait for the Experience.
3. The pawn data the experience carries
DefaultPawnData is typed as UCrimsonPawnDataBase, which is deliberately empty - this plugin must not know what your pawn data contains. Derive your own and cast back to it.
// MyPawnData.h#include "Character/CrimsonPawnDataBase.h"#include "MyPawnData.generated.h"UCLASS(BlueprintType, Const)class UMyPawnData : public UCrimsonPawnDataBase{GENERATED_BODY()public:UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Pawn")TSubclassOf<APawn> PawnClass;};// Reading it back, once the experience is loaded:if (const UMyPawnData* PawnData = Cast<UMyPawnData>(Experience->DefaultPawnData)){// PawnData->PawnClass ...}
DefaultPawnData picker offers your subclass. A cast that returns null means the asset points at a different UCrimsonPawnDataBase subclass.See also
- How-To: Wait for the Experience
- How-To: Share Actions with an Action Set
- Concept: The Load Sequence