feat: Pause-point snapshots now identify which instance was hit#1737
Merged
Conversation
Instance fields were captured but the paused instance itself was not, so a hit could not identify which instance or GameObject it landed on (name, hierarchy path, InstanceID), and scripts without any UnityEngine.Object field gave watch expressions no path to reach the instance via UloopPausePoint.TryGetCapturedValue. - Emit a "this" entry (new Scope "This") after locals/parameters and before instance fields, so the count cap keeps prioritizing locals/params; the existing formatter then attaches UnityObjectKind/Path/InstanceId for UnityEngine.Object instances - For async/coroutine state machines, resolve "this" to the hoisted outer instance via <>4__this and never surface the compiler-generated state machine; static methods emit no entry
Explain the new This scope, how the this entry identifies the hit
instance via UnityObjectPath/UnityObjectInstanceId, and how
TryGetCapturedValue("this") exposes the live reference while paused.
Skill copies under .agents/ and .claude/ are regenerated from the
source skill by the installer, not hand-edited.
Contributor
📝 WalkthroughWalkthroughAdds a public ChangesCaptured instance support
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PausePoint
participant SourcePausePointVariableCollector
participant AsyncStateMachine
participant CapturedVariables
PausePoint->>SourcePausePointVariableCollector: collect paused instance variables
SourcePausePointVariableCollector->>AsyncStateMachine: inspect instance type
AsyncStateMachine->>SourcePausePointVariableCollector: provide hoisted outer instance
SourcePausePointVariableCollector->>CapturedVariables: add synthetic "this"
SourcePausePointVariableCollector->>CapturedVariables: add locals, parameters, and instance fields
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Five pre-existing tests pinned exact captured-variable name lists from before the synthetic "this" entry existed. Update the expected sequences (and their explanatory comments) to include "this" at its spec'd position between parameters and instance fields; assertions stay exact rather than being loosened. The byref-like struct path is unchanged: the patcher passes a null instance there, so no "this" entry is expected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
thisentry inCapturedVariables, so the snapshot tells you which instance (and which GameObject, via its hierarchy path and InstanceID) the pause landed on.UloopPausePoint.TryGetCapturedValue("this")returns the live instance reference, so watch expressions and dynamic code can read values liketransform.positioneven when no captured field references a Unity object.User Impact
UnityEngine.Objectfield gave watch expressions no path to reach the instance at all.thisentry (new ScopeThis) carriesUnityObjectKind,UnityObjectPath, andUnityObjectInstanceIdfor Unity objects, identifying the hit instance at a glance and opening the raw-capture route to it.Changes
thisentry after locals/parameters and before instance fields, so the variable-count cap keeps prioritizing locals and parameters. No property expansion; it is a single compact entry.thisto the original outer instance (via the hoisted state-machine reference), never the compiler-generated state machine. Static methods — and the byref-like struct path, where the patcher passes a null instance — emit no entry.Thisscope constant; the wire format is unchanged (Scope is passed through as a string), so no protocol version bump.CliOnlyTools~; the.agents//.claude/copies were regenerated by the installer).thisentry existed; assertions stay exact, now includingthisat its spec'd position.Verification
uloop compile: 0 errors, 0 warningsuloop run-tests(EditMode, all pause-point suites): 144 passed / 0 failed, including 6 new collector tests (normal instance, entry ordering, state-machine outer-this resolution, missing outer-this, null instance, count-cap truncation)