Repository navigation
feat: Pause Unity at named debug breaks for inspection #1283
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
b86d9aa
Add named Unity pause point markers
hatayama f833be5
Add pause point wait CLI workflow
hatayama 466d2e7
Rename pause point API to UnityCliLoopDebug.Break
hatayama c18179c
Fix pause point review findings
hatayama 2a30675
Rename debug break CLI commands
hatayama d0fd38a
Rename debug break arm command to enable
hatayama 45acfd2
Release input simulations on debug break pause
hatayama 6e1f896
Add debug break status and busy state metadata
hatayama f101063
Document debug break inspection workflows
hatayama b3ee217
Improve debug break timeout diagnostics
hatayama 8a57e63
Clarify debug break diagnostics
hatayama 808cb61
Release input state on debug break interruption
hatayama b54f564
Fix SmoothDelta debug-break interruption
hatayama a258049
Bump CLI contract for debug-break commands
hatayama 288b373
Merge remote-tracking branch 'origin/v3-beta' into feature/hatayama/p…
hatayama 862e540
Improve Unity command diagnostics
hatayama 949da17
Trim Unity meta trailing whitespace
hatayama 3054c86
Fix debug-break wait timeout edge cases
hatayama d64b441
Expose debug break native commands in tool settings
hatayama e2deb9d
update skills
hatayama b391520
Capture editor state for busy responses
hatayama 65ee0a2
Remove input setting assumption from debug break skill
hatayama 025b24b
Clarify debug break skill trigger
hatayama 4a0b1dd
Encourage proactive debug break skill use
hatayama b45a26a
Broaden debug break skill trigger
hatayama 3319a32
Prefer debug break over transient polling
hatayama 8a3eb5e
Bump CLI requirement for debug break commands
hatayama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| --- | ||
| name: uloop-wait-for-debug-break | ||
| description: "Pause Unity at named checkpoints for frame-specific PlayMode bugs and transient input, physics, async, or UI state changes." | ||
| --- | ||
|
|
||
| # uloop wait-for-debug-break | ||
|
|
||
| Pause Unity when execution reaches a named marker in user code. | ||
|
|
||
| ## When to use | ||
|
|
||
| - Use when a bug appears only on a specific frame, timing window, animation step, physics tick, or `Update` / `FixedUpdate` branch. | ||
| - Use proactively when PlayMode E2E or development debugging depends on proving a transient runtime state transition. | ||
| - Use it alongside screenshots and logs; it is not only for cases where screenshots fail. | ||
| - Good checkpoints include jump applied, launch complete, collision handled, score changed, line cleared, block mined, item placed, game over shown, or UI updated after input. | ||
| - If you use sleep, repeated polling, or a second state read to catch a transient PlayMode state, prefer `wait-for-debug-break` instead. | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. Add a marker at the state you want to inspect: | ||
|
|
||
| ```csharp | ||
| using io.github.hatayama.UnityCliLoop.Runtime; | ||
|
|
||
| UnityCliLoopDebug.Break("player-jumped"); | ||
| ``` | ||
|
|
||
| 2. Compile the project. | ||
| 3. Enable the marker before triggering the code path: | ||
|
|
||
| ```bash | ||
| uloop enable-debug-break --id player-jumped --timeout-seconds 30 | ||
| ``` | ||
|
|
||
| 4. Check marker state if needed: | ||
|
|
||
| ```bash | ||
| uloop debug-break-status --id player-jumped | ||
| ``` | ||
|
|
||
| 5. Trigger the behavior, such as `simulate-keyboard`, `simulate-mouse-input`, UI interaction, or dynamic code. | ||
| 6. Wait for the marker: | ||
|
|
||
| ```bash | ||
| uloop wait-for-debug-break --id player-jumped --timeout-seconds 30 | ||
| ``` | ||
|
|
||
| If this command times out, the marker line was not reached while the command waited. Inspect `error.details.status`, `hitCount`, `isPlaying`, `isPaused`, `elapsedSinceEnabledMilliseconds`, and `remainingMilliseconds` to distinguish input not being consumed, gameplay conditions not being met, an id mismatch, or Unity already being paused. `elapsedSinceEnabledMilliseconds` is measured from `enable-debug-break`, not from `wait-for-debug-break`. | ||
|
|
||
| 7. While Unity is paused, inspect state with `uloop get-logs`, `uloop get-hierarchy`, `uloop find-game-objects`, screenshots, or `uloop execute-dynamic-code`. | ||
| 8. Clear the marker if you stop waiting: | ||
|
|
||
| ```bash | ||
| uloop clear-debug-break --id player-jumped | ||
| ``` | ||
|
|
||
| ## Marker placement | ||
|
|
||
| - Prefer natural gameplay or state-transition locations after input has been consumed, such as after jump velocity/state changes, physics contact, damage application, or inventory mutation. | ||
| - For frame-specific bugs, place the marker on the suspicious state branch or immediately after the state mutation you need to freeze. | ||
| - Enable markers after Play Mode is running, and prefer checkpoints reached after the triggering input command can return to avoid domain reload loss or tool Busy states. | ||
| - Avoid placing the marker immediately after issuing simulated input unless that exact input handling line is the state you need to inspect; immediate markers can interrupt the input command before the resulting gameplay state settles. | ||
| - Use separate ids for strict phases, for example `jump-input-read`, `jump-velocity-applied`, and `jump-landed`, instead of reusing one broad marker. | ||
|
|
||
| ## Safety | ||
|
|
||
| - `UnityCliLoopDebug.Break` uses Unity's conditional-call pattern and is compiled out of non-Editor call sites. | ||
| - Code in a custom asmdef must reference `UnityCLILoop.PausePoints.Runtime` to use `UnityCliLoopDebug.Break`. | ||
| - Do not pass side-effect expressions as the id argument. Use stable string ids. | ||
| - This does not collect logs or state snapshots. Use existing inspection commands after Unity pauses. | ||
| - If `enable-debug-break` warns about Domain Reload before PlayMode, the marker may be cleared when entering PlayMode. Domain Reload disabled is suitable for this workflow; otherwise enable again after PlayMode starts. |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| --- | ||
| name: uloop-wait-for-debug-break | ||
| description: "Pause Unity at named checkpoints for frame-specific PlayMode bugs and transient input, physics, async, or UI state changes." | ||
| --- | ||
|
|
||
| # uloop wait-for-debug-break | ||
|
|
||
| Pause Unity when execution reaches a named marker in user code. | ||
|
|
||
| ## When to use | ||
|
|
||
| - Use when a bug appears only on a specific frame, timing window, animation step, physics tick, or `Update` / `FixedUpdate` branch. | ||
| - Use proactively when PlayMode E2E or development debugging depends on proving a transient runtime state transition. | ||
| - Use it alongside screenshots and logs; it is not only for cases where screenshots fail. | ||
| - Good checkpoints include jump applied, launch complete, collision handled, score changed, line cleared, block mined, item placed, game over shown, or UI updated after input. | ||
| - If you use sleep, repeated polling, or a second state read to catch a transient PlayMode state, prefer `wait-for-debug-break` instead. | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. Add a marker at the state you want to inspect: | ||
|
|
||
| ```csharp | ||
| using io.github.hatayama.UnityCliLoop.Runtime; | ||
|
|
||
| UnityCliLoopDebug.Break("player-jumped"); | ||
| ``` | ||
|
|
||
| 2. Compile the project. | ||
| 3. Enable the marker before triggering the code path: | ||
|
|
||
| ```bash | ||
| uloop enable-debug-break --id player-jumped --timeout-seconds 30 | ||
| ``` | ||
|
|
||
| 4. Check marker state if needed: | ||
|
|
||
| ```bash | ||
| uloop debug-break-status --id player-jumped | ||
| ``` | ||
|
|
||
| 5. Trigger the behavior, such as `simulate-keyboard`, `simulate-mouse-input`, UI interaction, or dynamic code. | ||
| 6. Wait for the marker: | ||
|
|
||
| ```bash | ||
| uloop wait-for-debug-break --id player-jumped --timeout-seconds 30 | ||
| ``` | ||
|
|
||
| If this command times out, the marker line was not reached while the command waited. Inspect `error.details.status`, `hitCount`, `isPlaying`, `isPaused`, `elapsedSinceEnabledMilliseconds`, and `remainingMilliseconds` to distinguish input not being consumed, gameplay conditions not being met, an id mismatch, or Unity already being paused. `elapsedSinceEnabledMilliseconds` is measured from `enable-debug-break`, not from `wait-for-debug-break`. | ||
|
|
||
| 7. While Unity is paused, inspect state with `uloop get-logs`, `uloop get-hierarchy`, `uloop find-game-objects`, screenshots, or `uloop execute-dynamic-code`. | ||
| 8. Clear the marker if you stop waiting: | ||
|
|
||
| ```bash | ||
| uloop clear-debug-break --id player-jumped | ||
| ``` | ||
|
|
||
| ## Marker placement | ||
|
|
||
| - Prefer natural gameplay or state-transition locations after input has been consumed, such as after jump velocity/state changes, physics contact, damage application, or inventory mutation. | ||
| - For frame-specific bugs, place the marker on the suspicious state branch or immediately after the state mutation you need to freeze. | ||
| - Enable markers after Play Mode is running, and prefer checkpoints reached after the triggering input command can return to avoid domain reload loss or tool Busy states. | ||
| - Avoid placing the marker immediately after issuing simulated input unless that exact input handling line is the state you need to inspect; immediate markers can interrupt the input command before the resulting gameplay state settles. | ||
| - Use separate ids for strict phases, for example `jump-input-read`, `jump-velocity-applied`, and `jump-landed`, instead of reusing one broad marker. | ||
|
|
||
| ## Safety | ||
|
|
||
| - `UnityCliLoopDebug.Break` uses Unity's conditional-call pattern and is compiled out of non-Editor call sites. | ||
| - Code in a custom asmdef must reference `UnityCLILoop.PausePoints.Runtime` to use `UnityCliLoopDebug.Break`. | ||
| - Do not pass side-effect expressions as the id argument. Use stable string ids. | ||
| - This does not collect logs or state snapshots. Use existing inspection commands after Unity pauses. | ||
| - If `enable-debug-break` warns about Domain Reload before PlayMode, the marker may be cleared when entering PlayMode. Domain Reload disabled is suitable for this workflow; otherwise enable again after PlayMode starts. | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.