From c8312cee7e8c45b693581195718409e98c35c163 Mon Sep 17 00:00:00 2001 From: Jin Hyung Ahn Date: Tue, 7 Jul 2026 09:28:31 +0900 Subject: [PATCH] fix(cpp): UE 5.6 compatibility for UAnimStateNode result-node lookup UAnimStateNode::GetResultNodeInsideState() was added in UE 5.7, so the state-machine builder failed to compile on 5.6 (C2039). Guard it with an engine-version macro: use the official API on 5.7+, and on 5.6 (and older) find the state result by scanning the state's bound graph for the UAnimGraphNode_StateResult. Verified: BuildPlugin succeeds on UE 5.6, 5.7, and 5.8; the 5.7+ path is unchanged. --- .../Private/MCPythonHelper_AnimGraph.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Plugins/UnrealMCPython/Source/UnrealMCPython/Private/MCPythonHelper_AnimGraph.cpp b/Plugins/UnrealMCPython/Source/UnrealMCPython/Private/MCPythonHelper_AnimGraph.cpp index 7c14b99..7975f56 100644 --- a/Plugins/UnrealMCPython/Source/UnrealMCPython/Private/MCPythonHelper_AnimGraph.cpp +++ b/Plugins/UnrealMCPython/Source/UnrealMCPython/Private/MCPythonHelper_AnimGraph.cpp @@ -264,7 +264,22 @@ static FString BuildStateMachineFromSpec(UAnimBlueprint* AnimBP, const TSharedPt FBlueprintEditorUtils::RenameGraph(Bound, SD.Name); if (SD.Seq) { - if (UAnimGraphNode_StateResult* SR = State->GetResultNodeInsideState()) +#if ENGINE_MAJOR_VERSION > 5 || (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 7) + // UAnimStateNode::GetResultNodeInsideState() was added in UE 5.7. + UAnimGraphNode_StateResult* SR = State->GetResultNodeInsideState(); +#else + // UE 5.6 and earlier: find the state result by scanning the bound graph. + UAnimGraphNode_StateResult* SR = nullptr; + if (UEdGraph* Bound = State->GetBoundGraph()) + { + for (UEdGraphNode* N : Bound->Nodes) + { + if ((SR = Cast(N)) != nullptr) + break; + } + } +#endif + if (SR) { UEdGraphPin* SRIn = FindPinByName(SR, TEXT("Result"), EGPD_Input); SpawnSequencePlayer(State->GetBoundGraph(), SD.Seq, -400, 0, SRIn);