Summary
MCPForUnity.Runtime.Serialization.UnityEngineObjectConverter is a public JsonConverter<UnityEngine.Object> with a default constructor.
This makes it discoverable by packages/tools that scan loaded assemblies for Newtonsoft JsonConverter implementations and add them to global JsonConvert.DefaultSettings.
As a result, installing Unity MCP can unintentionally change unrelated project serialization behavior.
Problem
The converter serializes Unity assets as asset paths:
if (UnityEditor.AssetDatabase.Contains(value))
{
string path = UnityEditor.AssetDatabase.GetAssetPath(value);
writer.WriteValue(path);
}
That behavior is useful for MCP-internal serialization, but it is risky when the converter becomes globally discoverable.
Any unrelated code that serializes an object containing a ScriptableObject, Material, Texture, prefab reference, or other UnityEngine.Object may start receiving asset paths instead of normal object JSON.
Minimal Example
public class SomeConfig : ScriptableObject
{
public List<Row> Rows = new();
}
public struct Container
{
public SomeConfig Config;
}
var json = JsonConvert.SerializeObject(container);
Expected by unrelated project code:
{
"Config": {
"Rows": []
}
}
Possible result after global converter auto-discovery:
{
"Config": "Assets/Path/To/SomeConfig.asset"
}
Why This Is Surprising
The affected code does not call MCP APIs or MCP serializer settings directly. The behavior can change just because the MCP package is installed and its converter type is visible to external converter discovery.
One common trigger is jillejr.newtonsoft.json-for-unity.converters, which can scan loaded assemblies for public Newtonsoft converters and inject them into JsonConvert.DefaultSettings.
Suggested Fixes
Possible options:
- Make UnityEngineObjectConverter internal if it is only intended for MCP internals.
- Remove the public parameterless constructor so generic converter scanners do not instantiate it automatically.
- Move MCP-specific converters into an internal/editor-only assembly not intended for global discovery.
- Avoid exposing broad converters such as JsonConverter<UnityEngine.Object> publicly.
- Keep the converter public but require explicit MCP serializer settings to use it.
Environment
- Unity 6000.0.60f1
- com.coplaydev.unity-mcp
- Newtonsoft.Json via Unity package
- jillejr.newtonsoft.json-for-unity.converters
Summary
MCPForUnity.Runtime.Serialization.UnityEngineObjectConverteris a publicJsonConverter<UnityEngine.Object>with a default constructor.This makes it discoverable by packages/tools that scan loaded assemblies for Newtonsoft
JsonConverterimplementations and add them to globalJsonConvert.DefaultSettings.As a result, installing Unity MCP can unintentionally change unrelated project serialization behavior.
Problem
The converter serializes Unity assets as asset paths:
That behavior is useful for MCP-internal serialization, but it is risky when the converter becomes globally discoverable.
Any unrelated code that serializes an object containing a ScriptableObject, Material, Texture, prefab reference, or other UnityEngine.Object may start receiving asset paths instead of normal object JSON.
Minimal Example
Expected by unrelated project code:
{ "Config": { "Rows": [] } }Possible result after global converter auto-discovery:
{ "Config": "Assets/Path/To/SomeConfig.asset" }Why This Is Surprising
The affected code does not call MCP APIs or MCP serializer settings directly. The behavior can change just because the MCP package is installed and its converter type is visible to external converter discovery.
One common trigger is jillejr.newtonsoft.json-for-unity.converters, which can scan loaded assemblies for public Newtonsoft converters and inject them into JsonConvert.DefaultSettings.
Suggested Fixes
Possible options:
Environment