-
Notifications
You must be signed in to change notification settings - Fork 693
Fix manage_components set_property for object references #551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix manage_components set_property for object references #551
Conversation
Reviewer's GuideEnhances Unity object deserialization for the manage_components set_property action so that UnityEngine.Object references (including Transform, Component, and ScriptableObject fields) can be set from various JSON formats, and fixes ComponentOps.SetProperty to correctly locate private [SerializeField] fields across an inheritance hierarchy. Sequence diagram for manage_components SetProperty with enhanced Unity object resolutionsequenceDiagram
actor Tool
participant ComponentOps
participant Serializer as JsonSerializer
participant UnityObjConv as UnityEngineObjectConverter
participant EditorUtil as EditorUtility
participant AssetDB as AssetDatabase
participant GO as GameObject
participant Comp as Component
participant Tr as Transform
Tool->>ComponentOps: SetProperty(component, propertyName, valueToken, valueType, serializer)
ComponentOps->>ComponentOps: FindSerializedFieldInHierarchy(component.GetType, propertyName)
alt field found
ComponentOps->>Serializer: Deserialize valueToken as field.FieldType
Serializer->>UnityObjConv: ReadJson(reader, field.FieldType, existingValue, serializer)
alt value is GUID or path
UnityObjConv->>AssetDB: GUIDToAssetPath or LoadAssetAtPath
AssetDB-->>UnityObjConv: asset or null
else value has instanceID
UnityObjConv->>EditorUtil: InstanceIDToObject(instanceId)
EditorUtil-->>UnityObjConv: obj
alt obj is GameObject and expected Transform
UnityObjConv->>GO: access transform
GO-->>UnityObjConv: Tr
else obj is GameObject and expected Component subtype
UnityObjConv->>GO: GetComponent(expectedType)
GO-->>UnityObjConv: Comp or null
end
end
UnityObjConv-->>Serializer: resolved UnityEngine.Object or null
Serializer-->>ComponentOps: deserializedValue
ComponentOps->>Component: set field to deserializedValue
Component-->>ComponentOps: updated
ComponentOps-->>Tool: return true
else field not found
ComponentOps-->>Tool: return false
end
Updated class diagram for UnityEngineObjectConverter and ComponentOps behaviorclassDiagram
class UnityEngineObjectConverter {
+ReadJson(reader JsonReader, objectType Type, existingValue UnityEngine_Object, serializer JsonSerializer) UnityEngine_Object
-IsValidGuid(str string) bool
}
class ComponentOps {
+SetProperty(component Component, propertyName string, valueToken JToken, valueType Type, serializer JsonSerializer) bool
-FindSerializedFieldInHierarchy(type Type, fieldName string) FieldInfo
}
class UnityEngine_Object {
}
class Component {
}
class Transform {
}
class GameObject {
+transform Transform
+GetComponent(type Type) Component
}
class FieldInfo {
+GetCustomAttribute~SerializeField~() SerializeField
}
class SerializeField {
}
Component <|-- Transform
UnityEngine_Object <|-- Component
UnityEngine_Object <|-- GameObject
ComponentOps ..> FieldInfo : uses
ComponentOps ..> SerializeField : checks
UnityEngineObjectConverter ..> GameObject : resolves
UnityEngineObjectConverter ..> Transform : may return
UnityEngineObjectConverter ..> Component : may return
Flow diagram for UnityEngineObjectConverter.ReadJson deserialization logicgraph TD
A[Start ReadJson<br/>tokenType, objectType, existingValue] --> B{UNITY_EDITOR?}
B -- No --> C[Log warning<br/>UnityEngineObjectConverter cannot deserialize complex objects in non-Editor mode]
C --> D{tokenType == StartObject?}
D -- Yes --> E[JObject.Load skip object]
D -- No --> F[reader.ReadAsString skip string]
E --> G[Return existingValue]
F --> G[Return existingValue]
B -- Yes --> H{tokenType == Null?}
H -- Yes --> I[Return null]
H -- No --> J{tokenType == String?}
J -- Yes --> K[Read strValue = reader.Value.ToString]
K --> L{IsValidGuid strValue?}
L -- Yes --> M[normalizedGuid = strValue without hyphens]
M --> N[path = AssetDatabase.GUIDToAssetPath normalizedGuid]
N --> O{path not empty?}
O -- Yes --> P[asset = AssetDatabase.LoadAssetAtPath path, objectType]
P --> Q{asset != null?}
Q -- Yes --> R[Return asset]
Q -- No --> S[Log warning<br/>Could not load asset with GUID]
S --> T[Return null]
O -- No --> S
L -- No --> U[loadedAsset = AssetDatabase.LoadAssetAtPath strValue, objectType]
U --> V{loadedAsset != null?}
V -- Yes --> W[Return loadedAsset]
V -- No --> X[Log warning<br/>Could not load asset at path]
X --> W
J -- No --> Y{tokenType == StartObject?}
Y -- No --> Z[Log warning<br/>Unexpected token type when deserializing objectType]
Z --> AA[Return null]
Y -- Yes --> AB[jo = JObject.Load reader]
AB --> AC{jo has guid string?}
AC -- Yes --> AD[guid = jo.guid without hyphens]
AD --> AE[path = AssetDatabase.GUIDToAssetPath guid]
AE --> AF{path not empty?}
AF -- Yes --> AG[asset = AssetDatabase.LoadAssetAtPath path, objectType]
AG --> AH{asset != null?}
AH -- Yes --> AI[Return asset]
AH -- No --> AJ[Log warning<br/>Could not load asset with GUID]
AJ --> AK[Return null]
AF -- No --> AJ
AC -- No --> AL{jo has instanceID int?}
AL -- Yes --> AM[instanceId = jo.instanceID]
AM --> AN[obj = EditorUtility.InstanceIDToObject instanceId]
AN --> AO{obj != null?}
AO -- No --> AP[objectName = jo.name or unknown]
AP --> AQ[Log warning<br/>Could not resolve instance ID]
AQ --> AR[Return null]
AO -- Yes --> AS{objectType.IsAssignableFrom obj.GetType?}
AS -- Yes --> AT[Return obj]
AS -- No --> AU{objectType == Transform and obj is GameObject?}
AU -- Yes --> AV[Return obj.transform]
AU -- No --> AW{objectType is Component and obj is GameObject?}
AW -- Yes --> AX[component = obj.GetComponent objectType]
AX --> AY{component != null?}
AY -- Yes --> AZ[Return component]
AY -- No --> BA[Log warning<br/>GameObject missing component]
BA --> BB[Return null]
AW -- No --> BC[Log warning<br/>Type mismatch no automatic conversion]
BC --> BD[Return null]
AL -- No --> BE{jo has path string?}
BE -- Yes --> BF[path = jo.path]
BF --> BG[asset = AssetDatabase.LoadAssetAtPath path, objectType]
BG --> BH{asset != null?}
BH -- Yes --> BI[Return asset]
BH -- No --> BJ[Log warning<br/>Could not load asset at path]
BJ --> BK[Return null]
BE -- No --> BL[Log warning<br/>JSON object missing instanceID, guid, or path]
BL --> BM[Return null]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughReplaces direct reflection of non-public serialized fields with inheritance-aware traversal in ComponentOps, and extends UnityEngineObjectConverter.ReadJson to resolve UnityEngine.Object values via GUID, InstanceID, and path with type-conversion fallbacks and additional warnings and editor/runtime-safe behavior. Changes
Sequence Diagram(s)sequenceDiagram
participant JSON as JSON token
participant Conv as UnityEngineObjectConverter
participant AssetDB as AssetDatabase (Editor)
participant EditorUtil as EditorUtility (Editor)
participant Obj as UnityEngine.Object
JSON->>Conv: ReadJson(token)
alt token is string
Conv->>Conv: IsValidGuid(string)?
alt valid GUID
Conv->>AssetDB: GUIDToAssetPath(guid)
AssetDB-->>Conv: path or null
Conv->>AssetDB: LoadAssetAtPath(path, type)
AssetDB-->>Conv: Obj or null
else not GUID
Conv->>AssetDB: LoadAssetAtPath(path, type)
AssetDB-->>Conv: Obj or null
end
else token is object
alt has "guid"
Conv->>AssetDB: GUIDToAssetPath & LoadAssetAtPath(type)
AssetDB-->>Conv: Obj or null
else has "instanceID"
Conv->>EditorUtil: InstanceIDToObject(id)
EditorUtil-->>Conv: Obj or null
alt Obj found and type compatible
Conv-->>JSON: Obj
else Obj is GameObject & expected Transform
Conv->>Obj: get transform
Conv-->>JSON: Transform
else expected Component & Obj is GameObject
Conv->>Obj: GetComponent<T>()
Obj-->>Conv: Component or null (warn)
else type mismatch
Conv-->>JSON: null (warn)
end
else has "path"
Conv->>AssetDB: LoadAssetAtPath(path, type)
AssetDB-->>Conv: Obj or null
else
Conv-->>JSON: null (warn missing fields)
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (3)📚 Learning: 2025-12-29T15:23:11.613ZApplied to files:
📚 Learning: 2025-10-13T13:27:23.040ZApplied to files:
📚 Learning: 2025-09-03T16:00:55.839ZApplied to files:
🧬 Code graph analysis (2)MCPForUnity/Editor/Helpers/ComponentOps.cs (3)
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (5)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 1 issue, and left some high level feedback:
- The GUID detection/handling logic is duplicated between the string and JObject paths in UnityEngineObjectConverter.ReadJson; consider extracting a shared helper that takes a string GUID and target type and returns the loaded asset (or null) to keep behavior consistent and easier to maintain.
- FindSerializedFieldInHierarchy currently iterates all non-public instance fields on each type and compares the names; you could simplify and reduce overhead by using currentType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly) and then checking for [SerializeField] on the single returned field.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The GUID detection/handling logic is duplicated between the string and JObject paths in UnityEngineObjectConverter.ReadJson; consider extracting a shared helper that takes a string GUID and target type and returns the loaded asset (or null) to keep behavior consistent and easier to maintain.
- FindSerializedFieldInHierarchy currently iterates all non-public instance fields on each type and compares the names; you could simplify and reduce overhead by using currentType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly) and then checking for [SerializeField] on the single returned field.
## Individual Comments
### Comment 1
<location> `MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs:326` </location>
<code_context>
+ // Check if it looks like a GUID (32 hex chars, optionally with hyphens)
+ if (IsValidGuid(strValue))
+ {
+ string path = UnityEditor.AssetDatabase.GUIDToAssetPath(strValue.Replace("-", ""));
+ if (!string.IsNullOrEmpty(path))
+ {
</code_context>
<issue_to_address>
**suggestion:** Consider normalizing GUID case before passing to GUIDToAssetPath.
Unity asset GUIDs are usually lowercase hex. Here you strip hyphens but keep the original casing; if callers pass uppercase/mixed‑case GUIDs, `GUIDToAssetPath` may not resolve them. Consider normalizing with `strValue.Replace("-", "").ToLowerInvariant()` before calling `GUIDToAssetPath` to handle case variations robustly.
```suggestion
var normalizedGuid = strValue.Replace("-", "").ToLowerInvariant();
string path = UnityEditor.AssetDatabase.GUIDToAssetPath(normalizedGuid);
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
MCPForUnity/Editor/Helpers/ComponentOps.cs (1)
256-263: Inconsistency:GetAccessibleMembersdoesn't list inherited[SerializeField]fields thatSetPropertycan set.
SetPropertyusesFindSerializedFieldInHierarchyto walk the inheritance chain and set inherited[SerializeField]fields, butGetAccessibleMemberscallsGetFields(BindingFlags.NonPublic | BindingFlags.Instance)withoutDeclaredOnlyor hierarchy traversal. In .NET, private fields are not inherited by a singleGetFieldscall—the method will only find fields declared directly on the target type. This meansSetPropertycan set inherited serialized fields that won't appear in the list returned byGetAccessibleMembers, breaking the API contract.Update
GetAccessibleMembersto walk the inheritance hierarchy when collecting private[SerializeField]fields, similar toFindSerializedFieldInHierarchy.
🧹 Nitpick comments (1)
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs (1)
436-450: Efficient GUID validation.The manual hex validation avoids allocating a
Guidstruct and correctly handles both hyphenated and non-hyphenated formats.Alternatively,
System.Guid.TryParse(str, out _)could be used if readability is preferred over the minor allocation.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
MCPForUnity/Editor/Helpers/ComponentOps.csMCPForUnity/Runtime/Serialization/UnityTypeConverters.cs
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-12-29T15:23:11.613Z
Learnt from: msanatan
Repo: CoplayDev/unity-mcp PR: 491
File: MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs:78-115
Timestamp: 2025-12-29T15:23:11.613Z
Learning: In MCPForUnity, prefer relying on the established testing process to catch UI initialization issues instead of adding defensive null checks for UI elements in editor windows. This means during reviews, verify that tests cover UI initialization paths and that code avoids repetitive null-check boilerplate in Editor Windows. If a UI element can be null, ensure there is a well-tested fallback or that its initialization is guaranteed by design, rather than sprinkling null checks throughout editor code.
Applied to files:
MCPForUnity/Editor/Helpers/ComponentOps.cs
📚 Learning: 2025-10-13T13:27:23.040Z
Learnt from: msanatan
Repo: CoplayDev/unity-mcp PR: 316
File: TestProjects/UnityMCPTests/Assets/Tests/EditMode/Resources.meta:1-8
Timestamp: 2025-10-13T13:27:23.040Z
Learning: UnityMcpBridge is a legacy project kept for backwards compatibility; MCPForUnity is the only active Unity plugin project. GUID collisions between UnityMcpBridge and MCPForUnity are acceptable.
Applied to files:
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs
📚 Learning: 2025-09-03T16:00:55.839Z
Learnt from: dsarno
Repo: CoplayDev/unity-mcp PR: 0
File: :0-0
Timestamp: 2025-09-03T16:00:55.839Z
Learning: ComponentResolver in UnityMcpBridge/Editor/Tools/ManageGameObject.cs is a nested static class within ManageGameObject, not a sibling type. The `using static MCPForUnity.Editor.Tools.ManageGameObject;` import is required to access ComponentResolver methods directly without the outer class qualifier.
Applied to files:
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs
🧬 Code graph analysis (1)
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs (2)
MCPForUnity/Editor/Helpers/ObjectResolver.cs (3)
UnityEngine(32-105)UnityEngine(170-199)GameObject(110-129)MCPForUnity/Editor/Helpers/UnityTypeResolver.cs (3)
Type(103-108)Type(113-118)Type(123-128)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Sourcery review
🔇 Additional comments (7)
MCPForUnity/Editor/Helpers/ComponentOps.cs (2)
200-224: LGTM - Proper fix for inherited serialized fields.The switch to
FindSerializedFieldInHierarchycorrectly addresses the issue whereType.GetField()withNonPubliconly returns fields declared directly on that type, missing inherited private[SerializeField]fields.
271-300: Well-structured hierarchy traversal.The implementation correctly uses
DeclaredOnlyto fetch only fields declared on each type in the chain, then manually walks up viaBaseType. The case-insensitive comparison and[SerializeField]check ensure only the right fields are matched.MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs (5)
321-342: Good GUID auto-detection with path fallback.The string handling correctly distinguishes between GUID strings (32 hex chars) and asset paths, with appropriate warnings when resolution fails.
348-361: LGTM - GUID-based asset resolution.Correctly extracts and normalizes the GUID, then resolves via
AssetDatabase.
363-402: Well-designed smart type conversion.The cascading type resolution logic handles common Unity patterns well:
- Direct type match via
IsAssignableFromTransformextraction fromGameObject- Component fetching from
GameObjectviaGetComponentError messages include context (object name, instance ID) which aids debugging.
404-419: LGTM - Path resolution with helpful diagnostics.The path-based loading and the unrecognized format warning (which includes the object content) provide good debugging information.
421-433: Good defensive handling for edge cases.The unexpected token handling and non-editor fallback properly skip tokens to maintain reader state integrity, preventing cascading deserialization errors.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
327d15f to
1820722
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs`:
- Around line 426-433: The non-Editor deserialization branch in
UnityTypeConverters (UnityEngineObjectConverter) misuses reader.ReadAsString()
when reader.TokenType == JsonToken.String, which tries to read the next token
and can corrupt the reader; replace that specific call with reader.Skip() (or
simply call reader.Skip() for any non-StartObject token) so the current token is
advanced correctly, keep the JObject.Load(reader) for StartObject, and then
return existingValue as before.
♻️ Duplicate comments (2)
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs (2)
324-334: GUID case normalization already flagged.The GUID handling strips hyphens but doesn't normalize to lowercase. Unity's
GUIDToAssetPathmay not resolve mixed-case GUIDs. This was noted in a previous review.
350-361: Same GUID normalization issue applies here.Line 352 should also normalize to lowercase for consistency with the fix suggested for line 326.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
MCPForUnity/Editor/Helpers/ComponentOps.csMCPForUnity/Runtime/Serialization/UnityTypeConverters.cs
🚧 Files skipped from review as they are similar to previous changes (1)
- MCPForUnity/Editor/Helpers/ComponentOps.cs
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-13T13:27:23.040Z
Learnt from: msanatan
Repo: CoplayDev/unity-mcp PR: 316
File: TestProjects/UnityMCPTests/Assets/Tests/EditMode/Resources.meta:1-8
Timestamp: 2025-10-13T13:27:23.040Z
Learning: UnityMcpBridge is a legacy project kept for backwards compatibility; MCPForUnity is the only active Unity plugin project. GUID collisions between UnityMcpBridge and MCPForUnity are acceptable.
Applied to files:
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs
📚 Learning: 2025-09-03T16:00:55.839Z
Learnt from: dsarno
Repo: CoplayDev/unity-mcp PR: 0
File: :0-0
Timestamp: 2025-09-03T16:00:55.839Z
Learning: ComponentResolver in UnityMcpBridge/Editor/Tools/ManageGameObject.cs is a nested static class within ManageGameObject, not a sibling type. The `using static MCPForUnity.Editor.Tools.ManageGameObject;` import is required to access ComponentResolver methods directly without the outer class qualifier.
Applied to files:
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs
🧬 Code graph analysis (1)
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs (1)
MCPForUnity/Editor/Helpers/ObjectResolver.cs (3)
UnityEngine(32-105)UnityEngine(170-199)GameObject(110-129)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Sourcery review
🔇 Additional comments (3)
MCPForUnity/Runtime/Serialization/UnityTypeConverters.cs (3)
368-401: Well-designed type conversion hierarchy.The cascading type checks handle common Unity patterns elegantly:
- Direct type assignment
- GameObject → Transform extraction
- GameObject → Component via
GetComponentThe detailed warning messages with instance IDs and names will aid debugging.
404-419: LGTM!Path-based resolution and the unrecognized format fallback are correctly implemented. Including the JSON object in the warning message aids debugging.
436-450: LGTM!The GUID validation correctly handles 32 hex characters with or without hyphens, and properly accepts both upper and lowercase hex digits for flexible input matching.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Fixes deserialization of Transform, Component, and ScriptableObject
references in manage_components set_property action.
Changes to UnityEngineObjectConverter.ReadJson:
- Add GUID support: {"guid": "abc123..."} loads assets by GUID
- Add path support: {"path": "Assets/..."} loads assets by path
- Smart type conversion for instanceID:
- When expecting Transform but got GameObject, auto-extract .transform
- When expecting Component but got GameObject, auto-call GetComponent()
- Return null with warnings instead of throwing exceptions on failures
- Auto-detect GUID strings (32 hex chars) vs asset paths
Changes to ComponentOps.SetProperty:
- Add FindSerializedFieldInHierarchy() to traverse inheritance chain
- Fixes issue where private [SerializeField] fields from base classes
were not found (Type.GetField with NonPublic only searches declared type)
Supported input formats for object references:
- {"instanceID": 12345} - Scene objects (GameObjects, Components)
- {"guid": "abc123..."} - Assets by GUID
- {"path": "Assets/Foo.asset"} - Assets by path
- "Assets/Foo.asset" - Assets by path (string)
- "abc123..." - Assets by GUID (string, auto-detected)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1820722 to
3e30c68
Compare
⏺ ## Fix
manage_componentsset_property for object referencesProblem
The
manage_componentstool'sset_propertyaction failed when settingTransform,Component, orScriptableObjectreference fields, with errors like:"Unexpected token type 'EndObject' when deserializing UnityEngine.Object""Failed to convert value for property 'X' to type 'Transform'"Solution
Enhanced
UnityEngineObjectConverter.ReadJsonto properly deserialize object references:{"guid": "abc123..."}loads assets by GUID{"path": "Assets/..."}loads assets by pathTransformbut receiving aGameObjectinstanceID, automatically extracts.transform. Same for otherComponenttypes viaGetComponent().nullwith descriptive warnings instead of throwing exceptionsAlso fixed
ComponentOps.SetPropertyto traverse the inheritance hierarchy when searching for private[SerializeField]fields (previously only searched the declared type).Supported Input Formats
{"instanceID": 12345}- Scene objects (GameObjects, Components){"guid": "abc123..."}- Assets by GUID{"path": "Assets/Foo.asset"}- Assets by path"Assets/Foo.asset"- Assets by path (string)"abc123..."- Assets by GUID (auto-detected)Testing
Summary by Sourcery
Improve deserialization and property setting for Unity object references in editor tooling.
Bug Fixes:
Enhancements:
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.