Description

When playing in Standalone with multiple characters there's the the chance that one of the player states does not get set and remains null.

This is not a 100% repro case. Multiple tests may be required to see the issue.

Steps to Reproduce

1. Open UE4Editor (third person code project)
2. In the editor set up Action Mapping input for LMB
3. In the <ProjectName>Character.h add the following:

void checkPlayerState();

4. In <ProjectName>Character.cpp add the following function:

void A<ProjectName>Character::checkPlayerState()
{
	if (Controller->PlayerState != NULL)
	{
		GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Yellow, TEXT("Controller->PlayerState is ok"));
	}
	else
	{
		GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Yellow, TEXT("Controller->PlayerState is NULL"));
	}

	if (PlayerState != NULL)
	{
		GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Yellow, TEXT("PlayerState is ok"));
	}
	else
	{
		GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Yellow, TEXT("PlayerState is NULL"));
	}
}

5. In the SetupPlayerInputComponent() function add the following:

InputComponent->BindAction("<EditorInputName>", IE_Pressed, this, &A<ProjectName>Character::checkPlayerState);

6. Compile
7. In the editor click the drop down next to Play and choose Advanced Settings
8. Uncheck the box for "Use Single Process"
9. Set the Editor Multiplayer Mode to "Play as Listen Server"
10. Set number of players to 4
11. Play in Standalone mode
12. Press the LMB for each player window

Result:
When the players load in, one of the four is likely to show the player state is Null.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

7
Login to Vote

Cannot Reproduce
ComponentUE - Networking
Affects Versions4.8.24.9
CreatedJul 23, 2015
ResolvedMay 3, 2016
UpdatedJul 14, 2021