I am stuck on the “Accessing UI Classes in C++” in C++ because the way they are doing you should apparently never do and I understand why so I am trying to do it the right way.
This is what I’ve tryed:
UPROPERTY(EditAnywhere)
TSubclassOf<UUserWidget> MainMenuWidgetRef;
I can select a class in the BP version of the game instance but it doesn’t work with what I’m trying to do with it.
if (!ensure(MainMenuWidgetRef != nullptr)) return;
UE_LOG(LogTemp, Warning, TEXT("Found class %s"), MainMenuWidgetRef->GetName());
The ensure gives lots of errors.
How do I get BP classes to work with C++ preferably without a derived BP class of the C++ class game instance? And also without hard coding it which is the whole reason I’m not doing it the way they do it in the lecture.