-
Notifications
You must be signed in to change notification settings - Fork 657
fix: search inactive objects when setActive=true in modify #581
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
Conversation
When trying to activate an inactive GameObject via manage_gameobject modify with setActive=true, the lookup would fail because inactive objects were not included in the search by default. Now automatically sets searchInactive=true when setActive=true is specified, allowing inactive objects to be found and activated.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates GameObjectModify to ensure inactive GameObjects can be found and activated by automatically enabling inactive-object search when setActive=true in modify requests. Sequence diagram for modify with setActive=true searching inactive GameObjectssequenceDiagram
actor EditorUser
participant ManageGameObjectModify as GameObjectModify
participant ManageGameObjectCommon
participant UnityEngine as GameObject
EditorUser->>ManageGameObjectModify: Handle(params with setActive=true, targetToken, searchMethod)
ManageGameObjectModify->>ManageGameObjectModify: Check params.setActive == true
ManageGameObjectModify->>ManageGameObjectModify: Create findParams with searchInactive=true
ManageGameObjectModify->>ManageGameObjectCommon: FindObjectInternal(targetToken, searchMethod, findParams)
ManageGameObjectCommon-->>ManageGameObjectModify: targetGo (may be inactive)
ManageGameObjectModify->>GameObject: SetActive(true)
ManageGameObjectModify-->>EditorUser: Success or ErrorResponse
Class diagram for updated GameObjectModify inactive search behaviorclassDiagram
class GameObjectModify {
<<static>>
+Handle(JObject params, JToken targetToken, string searchMethod) object
}
class ManageGameObjectCommon {
<<static>>
+FindObjectInternal(JToken targetToken, string searchMethod, JObject findParams) GameObject
}
class JObject
class JToken
class GameObject {
+SetActive(bool isActive) void
}
GameObjectModify ..> ManageGameObjectCommon : uses
GameObjectModify ..> JObject : uses
GameObjectModify ..> JToken : uses
ManageGameObjectCommon ..> JToken : uses
ManageGameObjectCommon ..> JObject : uses
GameObjectModify ..> GameObject : activates via SetActive
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe change augments GameObjectModify.cs to enable searching for inactive objects when setActive is true. A findParams object is introduced and passed to FindObjectInternal as an additional parameter, extending the method signature from two to three parameters. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
✨ Finishing touches
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 left some high level feedback:
- Currently
findParamsis always set to{"searchInactive": true}whensetActive == true, which will override any existingsearchInactivepreference; consider merging with or respecting@params["searchInactive"]so callers can still explicitly control this behavior. - Instead of creating a new
JObjectsolely forsearchInactive, you might pass@params(or a shallow clone) intoFindObjectInternaland conditionally setsearchInactiveon it, which would avoid losing other potential lookup-related parameters.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Currently `findParams` is always set to `{"searchInactive": true}` when `setActive == true`, which will override any existing `searchInactive` preference; consider merging with or respecting `@params["searchInactive"]` so callers can still explicitly control this behavior.
- Instead of creating a new `JObject` solely for `searchInactive`, you might pass `@params` (or a shallow clone) into `FindObjectInternal` and conditionally set `searchInactive` on it, which would avoid losing other potential lookup-related parameters.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Upstream changes (v9.0.7 → v9.0.8): - fix: UIDocument serialization to prevent infinite loops (CoplayDev#586) - fix: Filter isCompiling false positives in Play mode (CoplayDev#582) - fix: search inactive objects when setActive=true (CoplayDev#581) - fix: Add Prefab Stage support for GameObject lookup (CoplayDev#573) - fix: Prevent infinite compilation loop in Unity 6 (CoplayDev#559) - fix: parse and validate read_console types (CoplayDev#565) - fix: Local HTTP server UI check (CoplayDev#556) - fix: Claude Code HTTP Remote UV path override detection - fix: ULF detection in Claude licensing (CoplayDev#569) - chore: Replace asmdef GUID references (CoplayDev#564) - docs: Streamline README for faster onboarding (CoplayDev#583) - Many new client configurators (VSCode, Cursor, Windsurf, etc.) Fork enhancements preserved: - "find" instruction handler in UnityTypeConverters.cs - MarkSceneOrPrefabDirty() helper for proper Prefab Stage support - IsInPrefabStage() and GetPrefabStageRoot() helpers - #main URL reference (no version tags) - TestProjects excluded Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Modify_SetActive_ActivatesObjectwhich was failing after the Prefab Stage PRmanage_gameobjectmodify withsetActive=true, the lookup would fail because inactive objects were not included in the search by defaultChanges
GameObjectModify.cs: Automatically setssearchInactive=truewhensetActive=trueis specified, allowing inactive objects to be found and activatedTest plan
Modify_SetActive_ActivatesObjecttest passesManageGameObjectModifyTestspassSummary by Sourcery
Ensure GameObject modify operations can activate inactive objects by including them in lookup when setActive is requested.
Bug Fixes:
Tests:
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.