Abhiroop Tandon
Abhiroop Tandon

Reputation: 61

A reference to a Blueprint Game Mode

I am new to Unreal Engine with a very basic knowledge of working with the blueprints and code together. I am having trouble with making a reference of my Blueprint Game Mode in the code.

The question is that i have a Game Mode Blueprint (BP_GameMode) and i need to make a reference of it in a class Flag something like this

BP_GameMode* TheGameMode = Cast<BP_GameMode>(GetWorld()->GetAuthGameMode());

Can anyone tell me how to do this? And i also wanted to ask that can i execute a custom event in my BP_GameMode like this??

TheGameMode->IncreamentScore(Amount);

Upvotes: 1

Views: 1499

Answers (1)

jantar
jantar

Reputation: 183

I don't think you can do it this way. If you have some custom methods in your GameMode, you should first create C++ GameMode class, which would be your "interface". In this class you create your functions, and if you really don't want to implement them in code, then you simply override it in your BP_GameMode (which should inherit from your C++ class).

Upvotes: 1

Related Questions