Hello,
This is my first post so I apologize if I fail to explain anything correctly.
I’ve noticed that in UE 4.24.1 the condition Role == ROLE_Authority
works in PIE but fails when ran as a standalone game. The game starts up but the Pawn cannot move. As a quick solution, I’ve had to use HasAuthority()
that seems to work in both PIE and standalone, but gives this warning:
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor
Has there been any changes to UE that cause this to happen? I’ve tried searching for the solution but have failed to find one.
Example code that will only work in PIE:
void AGoKart::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (Role == ROLE_AutonomousProxy)
{
FGoKartMove Move = CreateMove(DeltaTime);
SimulateMove(Move);
UnacknowledgedMoves.Add(Move);
Server_SendMove(Move);
}
if (Role == ROLE_Authority && GetRemoteRole() == ROLE_SimulatedProxy)
{
FGoKartMove Move = CreateMove(DeltaTime);
Server_SendMove(Move);
}
if (Role == ROLE_SimulatedProxy)
{
SimulateMove(ServerState.LastMove);
}
DrawDebugString(GetWorld(), FVector(0, 0, 100), GetEnumText(Role), this, FColor::White, DeltaTime);
}
Example code that runs in both PIE and standalone:
void AGoKart::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (!HasAuthority() || Role == ROLE_AutonomousProxy)
{
FGoKartMove Move = CreateMove(DeltaTime);
SimulateMove(Move);
UnacknowledgedMoves.Add(Move);
Server_SendMove(Move);
}
if (HasAuthority() || Role == ROLE_Authority && GetRemoteRole() == ROLE_SimulatedProxy)
{
FGoKartMove Move = CreateMove(DeltaTime);
Server_SendMove(Move);
}
if (Role == ROLE_SimulatedProxy)
{
SimulateMove(ServerState.LastMove);
}
DrawDebugString(GetWorld(), FVector(0, 0, 100), GetEnumText(Role), this, FColor::White, DeltaTime);
}
Thanks in advance.