diff --git a/UnityMcpBridge/Editor/Helpers/GameObjectSerializer.cs b/UnityMcpBridge/Editor/Helpers/GameObjectSerializer.cs
index 8a65ada..1a1b462 100644
--- a/UnityMcpBridge/Editor/Helpers/GameObjectSerializer.cs
+++ b/UnityMcpBridge/Editor/Helpers/GameObjectSerializer.cs
@@ -13,7 +13,7 @@ namespace UnityMcpBridge.Editor.Helpers
///
/// Handles serialization of GameObjects and Components for MCP responses.
/// Includes reflection helpers and caching for performance.
- ///
+ /// tew
public static class GameObjectSerializer
{
// --- Data Serialization ---
@@ -121,9 +121,42 @@ namespace UnityMcpBridge.Editor.Helpers
// Add the flag parameter here
public static object GetComponentData(Component c, bool includeNonPublicSerializedFields = true)
{
+ // --- Add Early Logging ---
+ // Debug.Log($"[GetComponentData] Starting for component: {c?.GetType()?.FullName ?? "null"} (ID: {c?.GetInstanceID() ?? 0})");
+ // --- End Early Logging ---
+
if (c == null) return null;
Type componentType = c.GetType();
+ // --- Special handling for Transform to avoid reflection crashes and problematic properties ---
+ if (componentType == typeof(Transform))
+ {
+ Transform tr = c as Transform;
+ // Debug.Log($"[GetComponentData] Manually serializing Transform (ID: {tr.GetInstanceID()})");
+ return new Dictionary
+ {
+ { "typeName", componentType.FullName },
+ { "instanceID", tr.GetInstanceID() },
+ // Manually extract known-safe properties. Avoid Quaternion 'rotation' and 'lossyScale'.
+ { "position", CreateTokenFromValue(tr.position, typeof(Vector3))?.ToObject