Multiplayer: How to check that the player is ready

Hi,
as the titles says. My client player start receiving message before it even has had the chance to create its AGameState.

I tried checking (below) before sending data to client

if (APawn->GetNetConnection()->State == EConnectionState::USOCK_Open)
{
    // Send data
}

This doesn’t work

Thank you :slight_smile:

Anyone who wants to know how I did a workaround here it is:

File .h

 class AMyCharacter : public ACharacter
    {
    ...

    virtual void OnRep_Controller() override;

    private:
        /** Sends ready message from client to server */
    	UFUNCTION(Reliable, Server, WithValidation)
    	void SRecvReady();

        #ifdef WITH_SERVER_CODE
        /** Player status */
	bool bReady;
        #endif
    ...
    }

File .cpp

void AMyCharacter::OnRep_Controller()
{
	Super::OnRep_Controller();

	if (IsLocallyControlled())
	{
		SRecvReady();
	}
}

void AMyCharacter::SRecvReady_Implementation()
{
#ifdef WITH_SERVER_CODE
	bReady = true;
#endif
}

bool AMyCharacter::SRecvReady_Validate()
{
#ifdef WITH_SERVER_CODE
	// Check if player already sent ready message
	return (!bReady);
#endif
        return false;
}

Hope this helps someone :slight_smile: