Alternative Solution: Load the menu from PlayerController BeginPlay

So I didn’t want to use blueprints as a personal challenge and now I really hope I’ll still be able to follow lectures down the line :smiley:

Anyway, instead I tried loading the Menu from Game mode, but learned how it is not replicated on clients. Placed the call in a custom PlayerController and now it seems to function properly:
.h

UCLASS()
class DEVTV_PUZZLE_API APuzzlePlayerController : public APlayerController
{
	GENERATED_BODY()
	
public:
	virtual void BeginPlay() override;

	class UGameInstance_Custom* GameInstance;

};

.ccp

void APuzzlePlayerController::BeginPlay()
{
	Super::BeginPlay();

	GameInstance = Cast<UGameInstance_Custom>(GetGameInstance());
	GameInstance->LoadMenu();
	UE_LOG(LogTemp, Warning, TEXT("Playercontroller Called Menu"));
}

I really love how this course inspires me to take some steps on my own and figure things out. Worth every penny. :slight_smile:

1 Like

Nice work! Well done seeing that the GameMode is server only.

Nice, I like this solution! While working on the challenge I was trying to figure out where to make the call in C++ but I saw Epic even does it in the level blueprint https://docs.unrealengine.com/en-US/Engine/UMG/HowTo/CreateMainMenu/index.html.