How to make such a cast in c++

Hi Senuareborn

Casting in Blueprint is different to how casting works in C++. You cast objects in C++ the same way as you would cast any data in C++. Note you will need to ensure your objects you are casting to has a C++ base as you cannot cast directly to Blueprint (well technically you can, but its not advised and you certainly will not be able to access any internal members).

This is an example on how to do that function in C++

.h 
UFUNCTION(BlueprintPure, Category = "Support Functions")
ATestGamemode* GetGamemode(); 

.cpp
ATestGamemode* ATestActor::GetGamemode()
{
	return Cast<ATestGamemode> ( UGameplayStatics::GetGameMode( GEngine->() ) );
}

Note you need to include: #include “Kismet/GameplayStatics.h” in order to access the GetGamemode() function.

Hope this helps.

Alex