Summary
Reading GameObject or prefab component properties through UnityMCP can crash the Unity Editor or disconnect the UnityMCP session when the target contains Photon Fusion NetworkBehaviour components.
Photon Fusion is a popular Unity multiplayer game development framework used by many real-time multiplayer projects. Because Fusion components are commonly attached to player rigs, networked interactables, projectiles, and other gameplay prefabs, this issue can block UnityMCP inspection workflows in a broad class of multiplayer Unity projects.
Photon Fusion IL weaving injects fields/properties with unsafe internal types such as Fusion.NetworkBehaviourBuffer, Fusion.NetworkBehaviourCallbackBuffer, Fusion.Networked+Internals, and Fusion.Changed<T>. These types can be reached by the current reflection-based component serializer and are not safe to access or serialize.
Impact
This affects UnityMCP workflows that inspect scene objects or prefabs containing Fusion components, including:
Fusion.NetworkObject
Fusion.NetworkTransform
Fusion.Addons.Physics.NetworkRigidbody3D
Fusion.XR.Host.Rig.NetworkRig
- Project-specific
NetworkBehaviour subclasses
Depending on the object and session state, the symptom can be an Editor crash or a UnityMCP session disconnect while awaiting the serialization result.
Expected Behavior
UnityMCP should skip unsafe Fusion-injected fields/properties and continue serializing safe component data.
Actual Behavior
UnityMCP may attempt to reflect and serialize unsafe Fusion-injected types, causing instability when accessing Fusion-related components.
Proposed Fix
Before reading component fields/properties, detect and skip unsafe types, including:
- known Fusion IL-weaved unsafe types
- generic containers wrapping those types
- arrays wrapping those types
- pointer/by-ref/ref-like types
A regression test should cover direct and nested unsafe Fusion-like types.
Validation
A fix was validated with:
- Unity 2022.3.62f1 EditMode targeted test
- Unity 6000.0.41f1 EditMode targeted test
- Manual UnityMCP validation against a real Photon Fusion project, including prefab-stage reads and scene-instantiated prefab reads
Summary
Reading GameObject or prefab component properties through UnityMCP can crash the Unity Editor or disconnect the UnityMCP session when the target contains Photon Fusion
NetworkBehaviourcomponents.Photon Fusion is a popular Unity multiplayer game development framework used by many real-time multiplayer projects. Because Fusion components are commonly attached to player rigs, networked interactables, projectiles, and other gameplay prefabs, this issue can block UnityMCP inspection workflows in a broad class of multiplayer Unity projects.
Photon Fusion IL weaving injects fields/properties with unsafe internal types such as
Fusion.NetworkBehaviourBuffer,Fusion.NetworkBehaviourCallbackBuffer,Fusion.Networked+Internals, andFusion.Changed<T>. These types can be reached by the current reflection-based component serializer and are not safe to access or serialize.Impact
This affects UnityMCP workflows that inspect scene objects or prefabs containing Fusion components, including:
Fusion.NetworkObjectFusion.NetworkTransformFusion.Addons.Physics.NetworkRigidbody3DFusion.XR.Host.Rig.NetworkRigNetworkBehavioursubclassesDepending on the object and session state, the symptom can be an Editor crash or a UnityMCP session disconnect while awaiting the serialization result.
Expected Behavior
UnityMCP should skip unsafe Fusion-injected fields/properties and continue serializing safe component data.
Actual Behavior
UnityMCP may attempt to reflect and serialize unsafe Fusion-injected types, causing instability when accessing Fusion-related components.
Proposed Fix
Before reading component fields/properties, detect and skip unsafe types, including:
A regression test should cover direct and nested unsafe Fusion-like types.
Validation
A fix was validated with: