Running one client in edtior with dedicatedserver is "NM_Standalone"?

Some thing very strange happen when I tested my game in edtior: with decated_server checked and run game in selected viewport, the NetMode of client side is NM_Standalone.
I check the src code:
//World.cpp

#if WITH_EDITOR
ENetMode UWorld::AttemptDeriveFromPlayInSettings() const
{
	if (WorldType == EWorldType::PIE)
	{
		const ULevelEditorPlaySettings* PlayInSettings = GetDefault<ULevelEditorPlaySettings>();
		if (PlayInSettings)
		{
			EPlayNetMode PlayNetMode;
			PlayInSettings->GetPlayNetMode(PlayNetMode);

			switch (PlayNetMode)
			{
			case EPlayNetMode::PIE_Client:
			{
				int32 NumberOfClients = 0;
				PlayInSettings->GetPlayNumberOfClients(NumberOfClients);

				bool bAutoConnectToServer = false;
				PlayInSettings->GetAutoConnectToServer(bAutoConnectToServer);

				// Playing as client without listen server in single process,
				// or as a client not going to connect to a server
				if(NumberOfClients == 1 || bAutoConnectToServer == false)
				{
					return NM_Standalone;
				}
				return NM_Client;
			}

Is it deliberate to return NM_Standalone when clientcount is 1? I mean no matter how many client there is, the server is always the server and so does the client.

Is it a bug?

And I debuged AActor::GetNetMode(), it returns NM_Client. I’m suspecting this is a bug. Developers just tolerated it along the way.

And I checked the codes within AActor::GetNetMode. It looks like this:

ENetMode UNetDriver::GetNetMode() const
{
	// Special case for PIE - forcing dedicated server behavior
#if WITH_EDITOR
	if (World && World->WorldType == EWorldType::PIE && IsServer())
	{
		if ( GEngine->GetWorldContextFromWorldChecked(World).RunAsDedicated )
		{
			return NM_DedicatedServer;
		}
	}
#endif

	// Normal
	return (IsServer() ? (GIsClient ? NM_ListenServer : NM_DedicatedServer) : NM_Client);
}

I’m not seeing the reason to make UWorld different with AActor

And When UWorld finished it’s NetDriver, It begins to return NM_Client…

ENetMode UWorld::InternalGetNetMode() const
{
	if ( NetDriver != NULL )
	{
		const bool bIsClientOnly = IsRunningClientOnly();
		return bIsClientOnly ? NM_Client : NetDriver->GetNetMode();
	}

I’m so sure it’s a bug

Epic, come and have a look at my post!

Hi darktemplar,

Based on the comments in the source, it appears like everything you’ve found is intentionally the way it is. Have you found an actual, reproducible bug that is caused by this code?

Hi darktemplar,

We haven’t heard from you in a while, so I’m going to mark this question as closed for tracking purposes. If you have any more information or would like to re-open the issue, feel free to add a comment.