Skip to content

fix: Pause points on physics callbacks now explain a silent no-hit#1848

Merged
hatayama merged 1 commit into
feature/pause-point-feedback-integrationfrom
fix/pause-point-physical-callback-diagnostics
Jul 19, 2026
Merged

fix: Pause points on physics callbacks now explain a silent no-hit#1848
hatayama merged 1 commit into
feature/pause-point-feedback-integrationfrom
fix/pause-point-physical-callback-diagnostics

Conversation

@hatayama

@hatayama hatayama commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Pause points on Unity physics message methods (OnCollisionEnter2D, OnTriggerEnter2D, etc.) can silently miss GameObjects that already existed when the marker was enabled. enable-pause-point and await-pause-point now surface a warning/hint explaining this instead of leaving the marker looking simply "never hit".

User Impact

  • Before: a pause point on a physics callback would time out with no hit and no explanation, even though the target method body was actually running. There was no way to tell a missed code path apart from Unity silently skipping the patched dispatch.
  • After: enable-pause-point returns an informational warning when the marker resolves to a physics message method on a MonoBehaviour, and a timed-out await-pause-point includes the same guidance in its hint, along with the workaround (recreate the GameObject after enabling, or embed UloopPausePoint.Pause("id") directly in the method body).

Changes

  • SourcePausePointPhysicalMessageMethods: recognizes the known Unity physics message method names (OnCollision*, OnTrigger*, OnParticleCollision).
  • SourcePausePointPatcher: adds the warning when the resolved method matches a physics message name and its declaring type is MonoBehaviour-derived.
  • pause_point_errors.go: extends the CLI-side timeout hint with the same guidance for HitCount == 0, since the CLI cannot resolve method identity itself.

Verification

  • dist/darwin-arm64/uloop compile --project-path <repo> → 0 errors / 0 warnings
  • dist/darwin-arm64/uloop run-tests --project-path <repo> --filter-type regex --filter-value "PausePoint" --timeout-seconds 240 → 174/174 passed
  • bash scripts/check-go-cli.sh → 0 lint issues, all Go packages pass (including project-runner/internal/projectrunner)

Review in cubic

Unity resolves a GameObject's physics message dispatch (OnCollisionEnter2D,
OnTriggerEnter2D, etc.) at registration time, independent of later Harmony
patches. A pause point on such a method silently misses any GameObject that
already existed when the marker was enabled, even though the method body
still runs on newly created instances. This was hard to diagnose because
enable-pause-point and the wait timeout gave no indication of the cause.

- Add SourcePausePointPhysicalMessageMethods to recognize the known physics
  message method names
- Surface an informational warning from enable-pause-point when the resolved
  method is a physics message method on a MonoBehaviour-derived type
- Extend the Go-side timeout hint with the same guidance, since the CLI only
  sees HitCount == 0 and cannot resolve the method identity itself
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9521dbeb-166a-41fc-9350-72fda1f01e35

📥 Commits

Reviewing files that changed from the base of the PR and between dec111b and c967ab4.

⛔ Files ignored due to path filters (4)
  • Assets/Tests/Editor/SourcePausePointPatcher/Fixtures/PatcherPhysicalCallbackMethodFixture.cs.meta is excluded by none and included by none
  • Assets/Tests/Editor/SourcePausePointPatcher/Fixtures/PatcherPhysicsNamedMethodOnPlainClassFixture.cs.meta is excluded by none and included by none
  • Assets/Tests/Editor/SourcePausePointPhysicalMessageMethodsTests.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointPhysicalMessageMethods.cs.meta is excluded by none and included by none
📒 Files selected for processing (9)
  • Assets/Tests/Editor/SourcePausePointPatcher/Fixtures/PatcherPhysicalCallbackMethodFixture.cs
  • Assets/Tests/Editor/SourcePausePointPatcher/Fixtures/PatcherPhysicsNamedMethodOnPlainClassFixture.cs
  • Assets/Tests/Editor/SourcePausePointPatcher/SourcePausePointPatcherTests.cs
  • Assets/Tests/Editor/SourcePausePointPhysicalMessageMethodsTests.cs
  • Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointConstants.cs
  • Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointPatcher.cs
  • Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointPhysicalMessageMethods.cs
  • cli/project-runner/internal/projectrunner/pause_point_errors.go
  • cli/project-runner/internal/projectrunner/pause_point_wait_test.go

📝 Walkthrough

Walkthrough

Changes

Adds Unity physics callback detection to pause-point patching, emits warnings for affected MonoBehaviour methods, and extends editor and CLI tests with callback fixtures and timeout guidance.

Physics callback warning flow

Layer / File(s) Summary
Physical message detection and warning contract
Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointPhysicalMessageMethods.cs, Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointConstants.cs
Defines recognized Unity physics callback names and the associated cached-dispatch warning text.
Patch warning integration
Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointPatcher.cs
Centralizes warning construction and adds the physics callback warning for MonoBehaviour methods.
Patch behavior coverage
Assets/Tests/Editor/SourcePausePointPatcher/..., Assets/Tests/Editor/SourcePausePointPhysicalMessageMethodsTests.cs
Tests callback detection and patch warnings for physics methods, ordinary methods, and non-MonoBehaviour types.
Timeout diagnostic guidance
cli/project-runner/internal/projectrunner/pause_point_errors.go, cli/project-runner/internal/projectrunner/pause_point_wait_test.go
Extends never-hit pause-point diagnostics and their test expectation with cached message-dispatch guidance.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Test
  participant SourcePausePointPatcher
  participant SourcePausePointPhysicalMessageMethods
  participant SourcePausePointConstants
  Test->>SourcePausePointPatcher: patch resolved method
  SourcePausePointPatcher->>SourcePausePointPhysicalMessageMethods: classify method name
  SourcePausePointPhysicalMessageMethods-->>SourcePausePointPatcher: return match status
  SourcePausePointPatcher->>SourcePausePointConstants: retrieve applicable warning
  SourcePausePointConstants-->>SourcePausePointPatcher: return warning text
  SourcePausePointPatcher-->>Test: return patch result and warning
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: improved pause-point behavior and diagnostics for physics callbacks.
Description check ✅ Passed The description is directly related to the changeset and accurately summarizes the new warnings, hints, and tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pause-point-physical-callback-diagnostics

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hatayama
hatayama merged commit 0e36f72 into feature/pause-point-feedback-integration Jul 19, 2026
2 checks passed
@hatayama
hatayama deleted the fix/pause-point-physical-callback-diagnostics branch July 19, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant