Well, today I decided to convert my SimpleShooter project to UE5 and the process was pretty smooth. Most of the game worked without any changes but found a couple of issues so I’m brain-dumping this here in case it’s of any use for someone else (or my future self):
-
The Health ProgressBar starts at 0 and doesn’t update on damage to the player.
Yet the damage to the player and enemies works without a hitch .
After trying to put a print node within the binding in WBP_HUD to see what was wrong, it refused to compile the graph with this error on log:
[Compiler] Binding: Property ' /Script/UMG.ProgressBar:PercentDelegate ' on Widget ' ProgressBar_0 ': Member:GetHealth Unable to bind DoubleProperty, unsupported type.
So I ended up removing the binding altogether and recreating it again. It worked! -
The game crashes to the editor after trying to restart the level.
Relevant part of the log:
LogLoad: Took 0.548727 seconds to LoadMap(/Game/Maps/UEDPIE_0_Sandbox) LogNet: Warning: Travel Failure: [ClientTravelFailure]: Failed to load package '/Game/Maps/UEDPIE_0_Sandbox'
LogNet: Warning: TravelFailure: ClientTravelFailure, Reason for Failure: 'Failed to load package '/Game/Maps/UEDPIE_0_Sandbox''. Shutting down PIE.
PIE: Warning: TravelFailure: ClientTravelFailure, Reason for Failure: 'Failed to load package '/Game/Maps/UEDPIE_0_Sandbox''. Shutting down PIE.
Notice it loaded the map perfectly just before this. It seems that name is autogenerated and that would explain why it fails, but the C++ just calls APlayerController::RestartLevel() on a timer, so it should still work, right?.
Anyway, that doesn’t seem to be the case in UE5, so another way to do it is to get the name of the current level and pass that to UGameplayStatics::OpenLevel(). In other words, I added a private method:
void AShooterPlayerController::RestartLevel()
{
UGameplayStatics::OpenLevel(this, FName(*GetWorld()->GetName()), false);
}
And substituted the call at the end of AShooterPlayerController::GameHasEnded like this:
GetWorldTimerManager().SetTimer(RestartTimer, this, &AShooterPlayerController::RestartLevel, RestartDelay);
That does the trick.
Kudos to unrealidiot: https://unrealidiot.com/how-to-reload-current-level-in-unreal-engine-4
So nothing else to worry. Except that error message that says that the game is out of streaming budget in some situations, like looking up:
Oh well. It seems to not be fatal, as ominous as it looks.
Any comments, alternative fixes or further explanation as to why these issues happen are appreciated.