Hey guys I just went from version 4.18.3 to 4.19 and now the line Func->SetNativeFunc((Native)&ASGameMode::BeginPlayMutatorHack);
both the engine and VS2017pro compilers now
spit out an couple of errors
(C2065 - Native is undeclared identifier)
and
(C3867 - ASGameMode::BeginPlayMutatorHack non-standard syntax; use & to create pointer to member)
I have been searching the hub but not able to find any infos on the Native class. I have included, engine and coreminimal headers. Any ideas?Thanks in advance.
here is the code in question :
void ASGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
{
// HACK: workaround to inject CheckRelevance() into the BeginPlay sequence
UFunction* Func = AActor::GetClass()->FindFunctionByName(FName(TEXT("ReceiveBeginPlay")));
Func->FunctionFlags |= FUNC_Native;
Func->SetNativeFunc((Native)&ASGameMode::BeginPlayMutatorHack); // ***this line spits out error***
/* Spawn all mutators. */
for (int32 i = 0; i < MutatorClasses.Num(); i++)
{
AddMutator(MutatorClasses[i]);
}
if (BaseMutator)
{
BaseMutator->InitGame(MapName, Options, ErrorMessage);
}
Super::InitGame(MapName, Options, ErrorMessage);
}
bool ASGameMode::CheckRelevance_Implementation(AActor* Other)
{
/* Execute the first in the mutator chain */
if (BaseMutator)
{
return BaseMutator->CheckRelevance(Other);
}
return true;
}
void ASGameMode::BeginPlayMutatorHack(FFrame& Stack, RESULT_DECL)
{
P_FINISH;
// WARNING: This function is called by every Actor in the level during his BeginPlay sequence. Meaning: 'this' is actually an AActor! Only do AActor things!
if (!IsA(ALevelScriptActor::StaticClass()) && !IsA(ASMutator::StaticClass()) &&
(RootComponent == NULL || RootComponent->Mobility != EComponentMobility::Static || (!IsA(AStaticMeshActor::StaticClass()) && !IsA(ALight::StaticClass()))))
{
ASGameMode* Game = GetWorld()->GetAuthGameMode<ASGameMode>();
// a few type checks being AFTER the CheckRelevance() call is intentional; want mutators to be able to modify, but not outright destroy
if (Game != NULL && Game != this && !Game->CheckRelevance((AActor*)this) && !IsA(APlayerController::StaticClass()))
{
/* Actors are destroyed if they fail the relevance checks (which moves through the gamemode specific check AND the chain of mutators) */
Destroy();
}
}
}