I’ve 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 a C++ class(not a gamemode class).
The question is that i have a Game Mode Blueprint (BP_GameMode) and i need to make a reference of it so that I can use certain functionalities defined in BP, something like this
BP_GameMode* GameModeRef = Cast<BP_GameMode>(GetWorld()->GetAuthGameMode()); GameModeRef->GetSomeValue();
I know that during compile time, compiler won’t know what is BP_GameMode and hence will throw an exception, so, is there a way to bypass this? Or any other way to get a reference to the blueprint gamemode and it’s members?
One other way I can think of is to create a C++ GameMode class, reparent BP_GameMode’s parent to the new C++ GameMode class and use this reference. But, I don’t want to do this Any suggestions would be great!