MothCocoon / FlowGraph

Design-agnostic node system for scripting game’s flow in Unreal Engine
https://discord.gg/Xmtr6GhbmW
MIT License
1.22k stars 241 forks source link

Unreal Editor Crashing due to custom node #169

Closed soraphis closed 1 year ago

soraphis commented 1 year ago

I can create a new flow graph, add my node and run the game. First it works, but after restarting the editor and running again, it crashes.

When I restart the editor, and try to open the flow graph I get this stacktrace:


>    UnrealEditor-FlowEditor-Win64-DebugGame.dll!SFlowGraphEditor::Construct(const SFlowGraphEditor::FArguments & InArgs, const TSharedPtr<FFlowAssetEditor,1> InAssetEditor) Line 44    C++
     UnrealEditor-FlowEditor-Win64-DebugGame.dll!RequiredArgs::T1RequiredArgs<TSharedRef<FFlowAssetEditor,1> &&>::CallConstruct<SFlowGraphEditor>(const TSharedRef<SFlowGraphEditor,1> & OnWidget, const SFlowGraphEditor::FArguments & WithNamedArgs) Line 749    C++
     UnrealEditor-FlowEditor-Win64-DebugGame.dll!TSlateDecl<SFlowGraphEditor,RequiredArgs::T1RequiredArgs<TSharedRef<FFlowAssetEditor,1> &&>>::operator<<=(const SFlowGraphEditor::FArguments & InArgs) Line 971    C++
     UnrealEditor-FlowEditor-Win64-DebugGame.dll!FFlowAssetEditor::CreateGraphWidget() Line 497    C++
     UnrealEditor-FlowEditor-Win64-DebugGame.dll!FFlowAssetEditor::CreateWidgets() Line 471    C++
     UnrealEditor-FlowEditor-Win64-DebugGame.dll!FFlowAssetEditor::InitFlowAssetEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost,1> & InitToolkitHost, UObject * ObjectToEdit) Line 292    C++
     UnrealEditor-FlowEditor-Win64-DebugGame.dll!FFlowEditorModule::CreateFlowAssetEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost,1> & InitToolkitHost, UFlowAsset * FlowAsset) Line 246    C++
     UnrealEditor-FlowEditor-Win64-DebugGame.dll!FAssetTypeActions_FlowAsset::OpenAssetEditor(const TArray<UObject *,TSizedDefaultAllocator<32>> & InObjects, TSharedPtr<IToolkitHost,1> EditWithinLevelEditor) Line 38    C++
     UnrealEditor-FlowEditor-Win64-DebugGame.dll!FAssetTypeActions_Base::OpenAssetEditor(const TArray<UObject *,TSizedDefaultAllocator<32>> & InObjects, const EAssetTypeActivationOpenedMethod OpenedMethod, TSharedPtr<IToolkitHost,1> EditWithinLevelEditor) Line 43    C++

I've already commented out everything the custom node does, it only has 3 output pins, 2 input pins. and has a TSoftObjectPtr to one of my custom asset types.

but still, hitting play or opening the node graph will crash the editor. (due to an access violation)

I commented out everything, and created a new graph. that works without crahes. then I've added ExecuteInput back in triggering one output, that already leads to the crashes, and when trying to open the graph it also crashes with above error. I don't realy get it, because the node does basically nothing and everything was commented out...

FlowGraph is on a FlowComponent on the PlayerCharacter

EDIT:

okay, I now have 2 flow graphs. both contain only my node and a log afterwards.

it's always the last executed graph, that crashes.

soraphis commented 1 year ago

It seems like, here GetGraph() returns null:

https://github.com/MothCocoon/FlowGraph/blob/5.2/Source/FlowEditor/Private/Graph/FlowGraphEditor.cpp#L36

MothDoctor commented 1 year ago

I'm puzzled here. Flow Asset has to have a Graph object. It's being created while creating a new UFlowAsset object.

Could you check if you don't have any custom logic that might skip this call? Or perhaps the problem might be the result of merging plugin updates? image

If your code is all fine, I'd need to get some minimal testing project. As I don't know how to reproduce it otherwise.

soraphis commented 1 year ago

It confused me aswell. Project of a colleague, when he send the project files to me, I could reproduce it on my machine.

In the end, he created a new class and basically replicated everything he did and now it's working for him, which feels strange to me, because we create a lot of flow graphs to make sure it's not the asset which got corrupted.

Need to see, how much of the project can be shared, though. I first thought it was because of the code. In the Initialize method the node was searching for a subsystem i think and kept a reference on that. but we later removed that part and commented out more and more stuff.

Will try to provide more info in the coming days

MothDoctor commented 1 year ago

Closing this for now. We could reopen it, if you'd find a repro :)