Casting to custom LocalPlayer class in Blueprint

I created a custom LocalPlayer class in c++. The header file looks like this:

UCLASS()
class ROBOTDEFENSECPP_API UBaseLocalPlayer : public ULocalPlayer
{
	GENERATED_BODY()

	/// ULocalPlayer Interface
public:
	virtual FString GetGameLoginOptions() const override;
};

But when I get the local player in blueprints, the node to cast to my BaseLocalPlayer class is not available.

Do you have any ideas, how I could get Unreal to create a “Cast to BaseLocalPlayer” Blueprint Node for me?

Hi,

You’re missing the BlueprintType Class Specifier:

UCLASS(BlueprintType)
class ROBOTDEFENSECPP_API UBaseLocalPlayer : public ULocalPlayer
{
    GENERATED_BODY()

Enjoy! :wink:

Thank you so much, MilkyEngineer!

You’re very welcome! :slight_smile: