I’m setting the variables in the class header, but they aren’t getting changed.
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSubclassOf<class UHudWidgetPrimary> PlayerHUDClass;
UPROPERTY()
class UHudWidgetPrimary* PlayerHUD;
In the .cpp file, I use this to get them
if (IsLocallyControlled() && PlayerHUDClass)
{
AMainPlayerCharacter::PlayerHUD = CreateWidget<UHudWidgetPrimary>(GetGameInstance(), AMainPlayerCharacter::PlayerHUDClass);
AMainPlayerCharacter::PlayerHUD->AddToPlayerScreen();
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, FString::Printf(TEXT("HUDclass is equal to %x"), PlayerHUDClass));
}
I have set the blueprint class to be the class that the game uses in the Project Settings, and it works in the standalone mode.
Other variables are set by the blueprint, and they all return as null when I try and access them.