Hi,
In 5.6, some of our network tests have started to fail, we are doing some operations with the ClientConnections cached in FBasePIENetworkComponentState, but all of the UNetConnections in that Array are null. It looks like the Component isn’t caching them properly anymore.
I noticed a change in CL 35177122 where a new function ( ConnectionClientsToServer() ) in PIENetworkComponent.cpp caches the existing connections from the NetDrive, but the for loop is starting from number of elements already in the ClientConnections array, which is initialised in a previous step with the ClientCount, essentially starting the loop at the end of the array.
I was also able to reproduce this problem in a blank project:
`#if ENABLE_PIE_NETWORK_TEST
NETWORK_TEST_CLASS( CustomNetworkTests, GenerateTestDirectory )
{
FPIENetworkComponent< FBasePIENetworkComponentState > Network { TestRunner, TestCommandBuilder, bInitializing };
BEFORE_EACH()
{
FNetworkComponentBuilder< FBasePIENetworkComponentState >()
.WithClients( 1 )
.WithGameInstanceClass( UGameInstance::StaticClass() )
.WithGameMode( AGameModeBase::StaticClass() )
.Build( Network );
TSharedRef< FNetworkGUID > SharedGuidForCharacter = MakeShared< FNetworkGUID >();
Network.ThenServer( TEXT( “Example Test” ), [&]( FBasePIENetworkComponentState & ServerState )
{
FActorSpawnParameters SpawnParameters;
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
ServerState.TestCharacter = ServerState.World->SpawnActor< APlatformingCharacter >( SpawnParameters );
UNetConnection* ClientConnection = ServerState.ClientConnections[ 0 ];
// ClientConnection is Null.
}
}
}
#endif // ENABLE_PIE_NETWORK_TEST`
Is there an additional set up that I am missing or is this a bug?
Thanks in advance,
Felipe