i have used unity only so i don’t know what is GetWorld(), GetAuthGameMode<> and using purpose.
help me guys.
GetWorld( ) returns the current world being used. Sort of the root of everything going on. It’s described as:
“The World is the top level object representing a map or a sandbox in which Actors and Components will exist and be rendered.”
GetAuthGameMode will return a reference to the worlds current game mode, which is valid during gameplay, when on a server.
As an example:
AMyGameMode *MyReplicatedActor::GetCurrentGameMode( )
{
if(GetWorld( ))
{
AMyGameMode *Game = Cast<AMyGameMode>(GetWorld( )->GetAuthGameMode( ));
if(Game)
{
return Game;
}
}
// cast or getworld failed
return nullptr;
}
or, through template version of the function:
AMyGameMode *MyReplicatedActor::GetCurrentGameMode( )
{
if(GetWorld( ))
{
AMyGameMode *Game = GetWorld( )->GetAuthGameMode<AMyGameMode>( );
if(Game)
{
return Game;
}
}
// cast or getworld failed
return nullptr;
}