Skip to content

Fix compile on UE 5.8: FJsonObject keys are now FSharedString - #48

Open
javidmedina wants to merge 1 commit into
Natfii:masterfrom
javidmedina:fix/ue-5.8-json-key-compat
Open

Fix compile on UE 5.8: FJsonObject keys are now FSharedString#48
javidmedina wants to merge 1 commit into
Natfii:masterfrom
javidmedina:fix/ue-5.8-json-key-compat

Conversation

@javidmedina

Copy link
Copy Markdown

What

FJsonObject::Values is keyed by UE::FSharedString in UE 5.8 rather than FString (see Runtime/Json/Public/Dom/JsonObject.h). Any loop over Values that passes Pair.Key where an FString is expected stops compiling. Ten call sites fail:

AnimationBlueprintUtils.cpp(930,16):        error C2665
MCPToolBase.h(173,15):                      error C2664
MCPToolBase.h(175,13):                      error C2665
MCPTool_AnimBlueprintModify.cpp(778,14):    error C2665
MCPTool_BlueprintModify.cpp(401,23):        error C2664
MCPTool_BlueprintModify.cpp(548,23):        error C2664
MCPTool_Material.cpp(544,10):               error C2664
MCPTool_Material.cpp(569,10):               error C2664
MCPTool_Material.cpp(587,10):               error C2664
MCPTool_SetProperty.cpp(379,35):            error C2039   (.ToUpper() on FSharedString)

How

Each site is wrapped as FString(*Pair.Key).

This is deliberately version-agnostic rather than #if ENGINE_MINOR_VERSION-gated: TSharedString::operator* returns const TCHAR*, and so does FString::operator*, so the same expression compiles against both the 5.8 shared-string storage and the older FString storage. No preprocessor branching, no behaviour change.

Not included

I left EngineVersion in UnrealClaude.uplugin at 5.7.0 so this stays a pure compile fix and doesn't change what the launcher reports for existing users. Anyone building for 5.8 will want to bump that locally.

Testing

Built against UE 5.8, Win64, Development Editor. Results:

  • Plugin module compiles clean
  • Module loads at PostEngineInit
  • Registered 28 MCP tools, MCP Server started on http://localhost:3000
  • GET /mcp/status returns {"status":"running","port":3000,"toolCount":28,...}

Not regression-tested against 5.7 — I don't have a 5.7 install — but the change is a no-op there by construction.

In UE 5.8, FJsonObject::Values is keyed by UE::FSharedString rather than
FString (Dom/JsonObject.h), so iterating Values and passing Pair.Key where an
FString is expected no longer compiles. Ten call sites fail with C2664/C2665/C2039.

Wrap each with FString(*Pair.Key). TSharedString::operator* returns const TCHAR*,
and FString::operator* does too, so this also compiles unchanged on 5.7 and earlier.

Verified by building the plugin against UE 5.8 (Win64, Development Editor): the
module compiles, loads, and the MCP server starts and serves all 28 tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant