I ran in to the same issue as Unreal Engine Issues and Bug Tracker (UE-174595) when calling IsNetMode
inside an override of AGameStateBase::PostInitializeComponents
.
I saw the fix in https://github.com/EpicGames/UnrealEngine/commit/ebe1e441eb90d125b433b60565425cff9c21b34b which is promising, however I suspect this may not fix the issue for calls to GetNetMode
/ IsNetMode
on most Actor classes (including eg. GameStates) as AActor does not actually use the UWorld::InternalGetNetMode implementation ( see AActor::GetNetMode and AActor::InternalGetNetMode
Locally we solved this by changing AActor::InternalGetNetMode
from
return NM_Standalone;
to
return World ? World->GetNetMode() : NM_Standalone;
This may also handle some other edge cases in AActor::InternalGetNetMode
to do with the NetDriver
being destructed according to some old comments I see related to this fix on our end.