UStruct / UObject and TSoftObjectPtr vars are not exposed to BP

I’m trying to create a UStruct or UObject that will hold a number of TSoftObjectPtr members that will be used to load clothes, shoes, helmets, etc for a character.

Here are some attempts:

USTRUCT:

USTRUCT(BlueprintType)
struct FEquipment {

	GENERATED_BODY()

	UPROPERTY(BlueprintReadWrite)
	TSoftObjectPtr<UMeshComponent> Mask;
};

and UObject:

UCLASS(Blueprintable, BlueprintType)
class FISTOFTHEWILD_API UCharacterEquipment : public UObject
{
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TSoftObjectPtr<UStaticMesh> Mask;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UStaticMesh* MaskX;
};

ACustomCharacter::ACustomCharacter(const class FObjectInitializer& ObjectInitializer) :
	Super(ObjectInitializer.SetDefaultSubobjectClass<UCustomCharacterMovementComponent>(ACharacter::CharacterMovementComponentName))
{
 	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	this->Equipment = NewObject<UCharacterEquipment>(this, UCharacterEquipment::StaticClass(), TEXT("equipment"));
}
class FISTOFTHEWILD_API ACustomCharacter : public ACharacter {
    ....

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Equipment")
UCharacterEquipment* Equipment;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Equipment")
FEquipment CharacterEquipment;
}

but I can’t set/see their values in BP defaults or in PIE:

BP class defaults:
image

instance of Character in PIE:

I wan’t these variables to be exposed for setting in PIE. what am I doing wrong?
is there a better way to do it?

For structs, use EditAnywhere for properties that have to be visible in BP or instance defaults.

UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSoftObjectPtr<UMeshComponent> Mask;

For UObjects it’s a bit more complex you need to specify EditInlineNew in the UCLASS of the UObject, and specify Instanced in the UPROPERTY, then you should be able to instantiate and edit the default subobject directly in the property. Properties of the subobject also require EditAnywhere to be visible.

Stick to struct if you don’t have any particular requirement for an object.

1 Like

It’s working.
I’ve added EditAnywhere for the USTRUCT props and it’s working. (honestly, I should have noticed it)
Thanks for the quick response.