Hi all,
So I’ve got a custom C++ controller class in which I instantiate a UMG blueprint for my main menu using this:
if (!mainMenuWidgetClass)
{
// Not populated, let's try grab our default one.
// This is the expected code path.
static ConstructorHelpers::FObjectFinder<UBlueprint> mainMenuBP(TEXT("WidgetBlueprint'/Game/UI/MainMenu/MainMenuWidget.MainMenuWidget'"));
if (mainMenuBP.Succeeded())
{
mainMenuWidgetClass = (UClass *)mainMenuBP.Object->GeneratedClass;
}
}
This all works fine using PIE or Standalone, but when I try package it the launched version complains it can’t find it.
I’ve tried adding the directory containing it to the additional directories to cook. I’ve also tried telling it to cook everything under content, neither of which fix it.
Then I tried adding a variable to the level blueprint that got set to that class OnBegin, but that didn’t fix it either.
I’m expecting a proposed work around will be to create a Blueprint player controller class and inherit from my C++ one and use it to set the type. But the problem is to do that and set the value I either then need to reference that Blueprint player controller class in my C++ GameMode, which puts me back to the same issue, or I need to make a Blueprint GameMode, which I can’t do because I have other C++ GameModes which inherit from my base one and doing so would mean they would need to inherit from a Blueprint class.
Cheers,
Alan.