Project Loading Hangs with FObjectFinder

anonymous_user_e6a6ed35
Thu, 14 Jul 2016 01:16:40 +0000
Blueprint

Apologies if this has been asked before, but most of the questions I found about FObjectFinder were using it outside a class constructor.

I have a C++ class with a Blueprint class asset extended from it. I call FObjectFinder to get the Blueprint class from the C++ class constructor. My project compiles & runs, everything appears fine. However, when I close the project and try to reopen it, the Editor gets stuck at 70%. There’s nothing wrong in the log file, it just hangs and I have to kill it from Task Manager. If I comment out FObjectFinder and recompile my code in Visual Studio, the project will load correctly so it’s definitely those lines. I’ve found one post about this on the Unreal forums, but the only suggested fix was to do this edit every time you load the project. Is there anything else I can try?

Some example code, both approaches result in the same error. In both cases, MyClassBlueprint is declared as a TSubclassOf < class ACustomClass > variable in the class’s header file.

ACustomClass::ACustomClass()
{
    static ConstructorHelpers::FObjectFinder<UBlueprint> MyBlueprint(TEXT("Blueprint'/Game/BP_CustomClass.BP_CustomClass'"));
    if (MyBlueprint.Object != NULL)
    {
        MyClassBlueprint = (UClass*)MyBlueprint.Object->GeneratedClass;
    }
}

ACustomClass::ACustomClass()
{
    static ConstructorHelpers::FObjectFinder<UClass> MyBlueprint(TEXT("Class'/Game/BP_CustomClass.BP_CustomClass_C'"));
    if (MyBlueprint.Object != NULL)
    {
        MyClassBlueprint = MyBlueprint.Object;
    }
}

,

2 posts - 1 participant