An old thread but I also had this problem and this is the result I was getting when searching for a fix.
Short story:
I forgat to check Windows application development
in Visual Studio 2022 17.10.4.
Long story:
I decided to upgrade to UE 5.4.2
and also update VS 2022 to latest version (by uninstalling my last version, not simply updating it). And when I was compiling UE 5.4.2 I was getting multiple errors Error LNK1181 cannot open input file 'wininet.lib'
. After lots of failed tests I noticed that I forgat to check in VS Windows application development
.
As for why I’m compiling UE 5.4.2 from source is that I added my own way of bringing back the option to not remove Widgets when world gets destroyed when calling ServerTravel
(which behavior was changed, in the past widgets were kept, but now they are removed, with no option to keep them).
I did this by adding a bool inside GameStateBase.h
:
UCLASS(config = Game, notplaceable, BlueprintType, Blueprintable, MinimalAPI)
class AGameStateBase : public AInfo
{
GENERATED_UCLASS_BODY()
public:
//~=============================================================================
// General accessors and variables
/** Whether all widgets should be removed when the level/map/world is changed */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = General)
uint32 bRemoveWidgets : 1;
then checking that value inside GameViewportSubsystem.cpp
:
void UGameViewportSubsystem::HandleRemoveWorld(UWorld* InWorld)
{
bool removeWidgets = true;
AGameStateBase* gameState = InWorld->GetGameState();
if (gameState) {
removeWidgets = gameState->bRemoveWidgets;
}
if (removeWidgets)
{
//Code that is already in this function by default
}
}
Don’t forget to also add inside this: #include "GameFramework/GameStateBase.h"
This way I can have widgets be kept or removed on what levels I want by simply checking that variable or unchecking it inside each level "Custom"GameState
default value.