satisfactorymodding / SatisfactoryModLoader

SatisfactoryModLoader is an unofficial tool to load mods for the game Satisfactory.
GNU General Public License v3.0
264 stars 174 forks source link

Compiling FGResearchTree blueprints instant-crashes the editor. #259

Closed baylf2000 closed 7 months ago

baylf2000 commented 7 months ago

When saving any blueprints based on FGResearchTree, the editor will instant-crash with the following error message:

Assertion failed: CastResult [File:G:\Unreal Engine - CSS\Engine\Source\Runtime\CoreUObject\Public\UObject\Field.h] [Line: 947] CastFieldChecked failed with 0x0000000000000000

0x00007ffbc19c65fb UnrealEditor-FactoryGame.dll!UFGResearchTree::IsDataValid() [G:\SatisfactoryModding\SatisfactoryModLoader\Source\FactoryGame\Private\FGResearchTree.cpp:54] 0x00007ffbe9315fd2 UnrealEditor-Engine.dll!UnknownFunction [] 0x00007ffbed1449e5 UnrealEditor-CoreUObject.dll!UnknownFunction [] 0x00007ffbb4306098 UnrealEditor-DataValidation.dll!UnknownFunction [] 0x0000000000000001 UnknownFunction []

There is the following if statement at that location in FGResearchTree.cpp which, when disabled, allows saves as normal.

    // Lazily initialize research tree node reflection properties for faster access
    if (ResearchTreeNodeClass == NULL) {
        ResearchTreeNodeClass = LoadClass<UFGResearchTreeNode>(NULL, TEXT("/Game/FactoryGame/Schematics/Research/BPD_ResearchTreeNode.BPD_ResearchTreeNode_C"));
        check(ResearchTreeNodeClass);
        //Make sure class is not garbage collected
        ResearchTreeNodeClass->AddToRoot();

        NodeDataStructProperty = CastFieldChecked<FStructProperty>(ResearchTreeNodeClass->FindPropertyByName(TEXT("mNodeDataStruct")));

        // Generated structs names contain GUIDs, so we can't use FindPropertyByName
        for(FField* StructProp = NodeDataStructProperty->Struct->ChildProperties; StructProp; StructProp = StructProp->Next) {
            if (FClassProperty* ClassProp = CastField<FClassProperty>(StructProp)) {
                if (ClassProp->MetaClass->IsChildOf(UFGSchematic::StaticClass())) {
                    SchematicStructProperty = ClassProp;
                    break;
                }
            }
        }
    }
baylf2000 commented 7 months ago

Sorry, this turned out to be a damaged file which, when replaced, solved the issue.