# Fix for UE-174595 UWorld::GetNetMode during PIE is also needed for AActor::GetNetMode

**URL:** <https://forums.unrealengine.com/t/fix-for-ue-174595-uworld-getnetmode-during-pie-is-also-needed-for-aactor-getnetmode/792241>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, bug-report, editor, question\
**Created:** [March 16, 2023, 3:23pm UTC](https://forums.unrealengine.com/t/fix-for-ue-174595-uworld-getnetmode-during-pie-is-also-needed-for-aactor-getnetmode/792241 "2023-03-16T15:23:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![efokschaner](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@efokschaner](https://forums.unrealengine.com/u/efokschaner)\
**Post date:** [March 16, 2023, 3:23pm UTC](https://forums.unrealengine.com/t/fix-for-ue-174595-uworld-getnetmode-during-pie-is-also-needed-for-aactor-getnetmode/792241/1 "2023-03-16T15:23:01Z")

</div>

I ran in to the same issue as [Unreal Engine Issues and Bug Tracker (UE-174595)](https://issues.unrealengine.com/issue/UE-174595) when calling `IsNetMode` inside an override of `AGameStateBase::PostInitializeComponents`.

I saw the fix in [https://github.com/EpicGames/UnrealEngine/commit/ebe1e441eb90d125b433b60565425cff9c21b34b](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](https://github.com/EpicGames/UnrealEngine/blob/5ca9da84c694c6eee288c30a547fcaa1a40aed9b/Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h#L4255) and [AActor::InternalGetNetMode](https://github.com/EpicGames/UnrealEngine/blob/5ca9da84c694c6eee288c30a547fcaa1a40aed9b/Engine/Source/Runtime/Engine/Private/Actor.cpp#L4665)

Locally we solved this by changing `AActor::InternalGetNetMode` from

```auto
return NM_Standalone;

```

to

```auto
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.

---

<div class="post-metadata">

**Author:** ![efokschaner](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@efokschaner](https://forums.unrealengine.com/u/efokschaner)\
**Post date:** [March 23, 2023, 9:11pm UTC](https://forums.unrealengine.com/t/fix-for-ue-174595-uworld-getnetmode-during-pie-is-also-needed-for-aactor-getnetmode/792241/2 "2023-03-23T21:11:48Z")

</div>

It turns out this has also been fixed in ue5-main [https://github.com/EpicGames/UnrealEngine/commit/e31dad7541b3d9f0d2fcd44311f1193c0391b8f3](https://github.com/EpicGames/UnrealEngine/commit/e31dad7541b3d9f0d2fcd44311f1193c0391b8f3)
