Hello Napoleonite,
Let me try to help you out there
That code seems to be extremely long for what it’s doing. Also, the workaround is even more complicated. If you want, I can try to guide you through read all of that, but it’s pretty much putting bandage on top of an old bandage in hopes it fixes the bandage, instead of the problem itself.
So, I suggest you replace your entire code like this:
// Take the paths out of the function, it's easier to replace later on ;)
// Make sure those paths are correct!
#define GUI_PLAYEREYE "/Game/UI/BP_PlayerEye_GUI"
#define GUI_DEBUG "/Game/UI/BP_Debug_GUI"
APlayerEye_Controller::APlayerEye_Controller()
{
static ConstructorHelpers::FClassFinder<UBlueprint> GUI_PlayerEye_BP(TEXT(GUI_PLAYEREYE));
GUI_PlayerEye_Class = GUI_PlayerEye_BP.Class;
static ConstructorHelpers::FClassFinder<UBlueprint> GUI_Debug_BP(TEXT(GUI_DEBUG));
GUI_Debug_Class = GUI_Debug_BP.Class;
}
And get rid of GetClassFromBlueprint(). Much simpler this way.
You can always remove the #define’s and put the text in place if you prefer too, I just think it’s easier to read that way.
Also, I’m pretty sure you should replace UBlueprint with UUserWidget, but since I"m not sure of your setup, I left as is.
About why the error happens… The ConstructorHelpers::FClassFinder() is a static function that is supposed to run only in the constructor.
Also, there’s no need to log that specific action (that’s what the GetClassFromBlueprint() is doing, right?) - Error in those are instantly listed in the constructor, like in your screenshot.
If you still have those errors, with “null” in them, make sure the path is correct and the blueprints are valid.
I hope this helps!