Skip to content

fix: Player builds stay free of editor-only uLoop tooling#1229

Merged
hatayama merged 5 commits into
v3-betafrom
feature/hatayama/fix-mouse-simulation-build
May 27, 2026
Merged

fix: Player builds stay free of editor-only uLoop tooling#1229
hatayama merged 5 commits into
v3-betafrom
feature/hatayama/fix-mouse-simulation-build

Conversation

@hatayama

Copy link
Copy Markdown
Owner

Summary

  • Player builds now avoid pulling in editor-only input visualization components and bundled code-analysis assemblies.
  • Third-party notices now document the bundled .NET assemblies used by editor code execution tooling.

User Impact

  • Before this change, Mono player builds with managed stripping disabled could include editor-only overlay components and code-analysis DLLs from the package.
  • After this change, input overlay tooling remains available in the Editor while player builds exclude the editor-only component implementations and code-analysis plugins.
  • A local consumer project was file-referenced to this package and built successfully for macOS with Mono and managed stripping disabled.

Changes

  • Compile input visualization and simulation overlay runtime sources only in the Unity Editor.
  • Mark input visualization prefabs as EditorOnly so Unity excludes them from player builds.
  • Restrict bundled code-analysis plugin importers to the Editor platform and add focused importer tests.
  • Add third-party notices for the bundled .NET assemblies.

Verification

  • Packages/src/Cli~/dist/darwin-arm64/uloop compile --project-path <PACKAGE_PROJECT_ROOT>
  • Packages/src/Cli~/dist/darwin-arm64/uloop run-tests --project-path <PACKAGE_PROJECT_ROOT> --test-mode EditMode --filter-type regex --filter-value ".(InputVisualizationCanvasPrefabTests|CodeAnalysisPluginImporterTests)."
  • codex-review v3-beta with compile and focused EditMode tests: clean, no accepted/actionable findings
  • Local consumer validation: file-referenced this package, compiled with 0 errors / 0 warnings, and built a macOS Mono player with managed stripping disabled successfully

hatayama added 5 commits May 28, 2026 00:03
Wrap prefab-attached visualization MonoBehaviours in UNITY_EDITOR so Player builds do not compile the mouse, keyboard, record, and replay overlay components.
Add a prefab contract guard to keep those component sources editor-only while preserving Editor prefab references.
Mark the shared input visualization prefabs and their overlay GameObjects with Unity's EditorOnly tag as an additional guard against Player build inclusion.
Add an EditMode prefab contract test so future prefab changes keep the tag intact.
Wrap the remaining runtime overlay support sources with UNITY_EDITOR so player
builds retain only a minimal generated runtime assembly while editor prefab
attachment and existing asmdef contracts stay unchanged.
Bundled Roslyn support assemblies are required only by the editor dynamic-code pipeline. Mark them Editor-only so Unity does not expose them to player assembly resolution, and add an importer test for the setting.
Document the Microsoft NuGet package sources and MIT license text for the bundled CodeAnalysis support assemblies distributed with the Unity package.
@coderabbitai

coderabbitai Bot commented May 27, 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: 580c97ae-6cf4-42bb-94b8-62b5c7ac17cd

📥 Commits

Reviewing files that changed from the base of the PR and between 99af542 and 4356f1c.

⛔ Files ignored due to path filters (11)
  • Assets/Tests/Editor/DynamicCodeToolTests/CodeAnalysisPluginImporterTests.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Plugins/CodeAnalysis/System.Collections.Immutable.dll.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Plugins/CodeAnalysis/System.Reflection.Metadata.dll.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Plugins/CodeAnalysis/System.Runtime.CompilerServices.Unsafe.dll.meta is excluded by none and included by none
  • Packages/src/Runtime/Common/InputVisualizationCanvas.prefab is excluded by !**/*.prefab and included by none
  • Packages/src/Runtime/RecordInput/RecordInputOverlay.prefab is excluded by !**/*.prefab and included by none
  • Packages/src/Runtime/ReplayInput/ReplayInputOverlay.prefab is excluded by !**/*.prefab and included by none
  • Packages/src/Runtime/SimulateKeyboard/SimulateKeyboardOverlay.prefab is excluded by !**/*.prefab and included by none
  • Packages/src/Runtime/SimulateMouseInput/SimulateMouseInputOverlay.prefab is excluded by !**/*.prefab and included by none
  • Packages/src/Runtime/SimulateMouseUi/SimulateMouseUiOverlay.prefab is excluded by !**/*.prefab and included by none
  • Packages/src/THIRD-PARTY-NOTICES.md.meta is excluded by none and included by none
📒 Files selected for processing (21)
  • Assets/Tests/Editor/DynamicCodeToolTests/CodeAnalysisPluginImporterTests.cs
  • Assets/Tests/Editor/InputVisualizationCanvasPrefabTests.cs
  • Packages/src/Runtime/Common/InputVisualizationCanvas.cs
  • Packages/src/Runtime/Common/MouseButton.cs
  • Packages/src/Runtime/RecordInput/RecordInputOverlayPresenter.cs
  • Packages/src/Runtime/RecordInput/RecordInputOverlayState.cs
  • Packages/src/Runtime/RecordInput/RecordInputOverlayView.cs
  • Packages/src/Runtime/ReplayInput/ReplayInputOverlay.cs
  • Packages/src/Runtime/ReplayInput/ReplayInputOverlayState.cs
  • Packages/src/Runtime/SimulateKeyboard/KeySymbolMap.cs
  • Packages/src/Runtime/SimulateKeyboard/KeyboardAction.cs
  • Packages/src/Runtime/SimulateKeyboard/SimulateKeyboardOverlay.cs
  • Packages/src/Runtime/SimulateKeyboard/SimulateKeyboardOverlayState.cs
  • Packages/src/Runtime/SimulateMouseInput/MouseInputAction.cs
  • Packages/src/Runtime/SimulateMouseInput/SimulateMouseInputOverlay.cs
  • Packages/src/Runtime/SimulateMouseInput/SimulateMouseInputOverlayState.cs
  • Packages/src/Runtime/SimulateMouseUi/MouseAction.cs
  • Packages/src/Runtime/SimulateMouseUi/SimulateMouseUiAnimationConstants.cs
  • Packages/src/Runtime/SimulateMouseUi/SimulateMouseUiOverlay.cs
  • Packages/src/Runtime/SimulateMouseUi/SimulateMouseUiOverlayState.cs
  • Packages/src/THIRD-PARTY-NOTICES.md

📝 Walkthrough

Walkthrough

This PR gates 18 runtime overlay and input-simulation types to editor-only compilation using #if UNITY_EDITOR preprocessor directives and adds comprehensive test validation. Test fixtures now validate that bundled Roslyn plugins are editor-only, overlay prefabs are tagged appropriately, and runtime sources use the same guards.

Changes

Editor-only gating and validation for input overlays

Layer / File(s) Summary
Test infrastructure for editor-only contract validation
Assets/Tests/Editor/DynamicCodeToolTests/CodeAnalysisPluginImporterTests.cs, Assets/Tests/Editor/InputVisualizationCanvasPrefabTests.cs
Adds CodeAnalysisPluginImporterTests to validate Roslyn plugin DLLs are editor-only, extends InputVisualizationCanvasPrefabTests with two new tests that load overlay prefabs and assert all children are tagged "EditorOnly", and scan runtime sources to verify each file begins with #if UNITY_EDITOR. Includes AssertEditorOnlyTags helper for prefab hierarchy validation.
Editor-only gates for input visualization and record overlays
Packages/src/Runtime/Common/InputVisualizationCanvas.cs, Packages/src/Runtime/Common/MouseButton.cs, Packages/src/Runtime/RecordInput/RecordInputOverlayPresenter.cs, Packages/src/Runtime/RecordInput/RecordInputOverlayState.cs, Packages/src/Runtime/RecordInput/RecordInputOverlayView.cs
Wraps InputVisualizationCanvas, MouseButton, and all RecordInputOverlay* types with #if UNITY_EDITOR guards, restricting these editor-only components to editor builds.
Editor-only gates for replay input overlays
Packages/src/Runtime/ReplayInput/ReplayInputOverlay.cs, Packages/src/Runtime/ReplayInput/ReplayInputOverlayState.cs
Wraps ReplayInputOverlay and ReplayInputOverlayState with #if UNITY_EDITOR guards.
Editor-only gates for keyboard simulation overlays
Packages/src/Runtime/SimulateKeyboard/KeySymbolMap.cs, Packages/src/Runtime/SimulateKeyboard/KeyboardAction.cs, Packages/src/Runtime/SimulateKeyboard/SimulateKeyboardOverlay.cs, Packages/src/Runtime/SimulateKeyboard/SimulateKeyboardOverlayState.cs
Wraps all keyboard simulation types (KeySymbolMap, KeyboardAction, SimulateKeyboardOverlay*) with #if UNITY_EDITOR guards.
Editor-only gates for mouse input simulation overlays
Packages/src/Runtime/SimulateMouseInput/MouseInputAction.cs, Packages/src/Runtime/SimulateMouseInput/SimulateMouseInputOverlay.cs, Packages/src/Runtime/SimulateMouseInput/SimulateMouseInputOverlayState.cs
Wraps mouse input simulation types (MouseInputAction, SimulateMouseInputOverlay*) with #if UNITY_EDITOR guards.
Editor-only gates for mouse UI animation overlays
Packages/src/Runtime/SimulateMouseUi/MouseAction.cs, Packages/src/Runtime/SimulateMouseUi/SimulateMouseUiAnimationConstants.cs, Packages/src/Runtime/SimulateMouseUi/SimulateMouseUiOverlay.cs, Packages/src/Runtime/SimulateMouseUi/SimulateMouseUiOverlayState.cs
Wraps mouse UI simulation types (MouseAction, SimulateMouseUiAnimationConstants, SimulateMouseUiOverlay*) with #if UNITY_EDITOR guards.
Third-party licensing documentation
Packages/src/THIRD-PARTY-NOTICES.md
Adds complete third-party notices for bundled Microsoft .NET assemblies, including package/assembly versions, asset paths, MIT license text, and NuGet/repository links.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#1195: Adjusts runtime asmdef contract and prefab-loading tests to keep overlay references valid when the runtime assembly is not auto-referenced, complementing the editor-only gating.
  • hatayama/unity-cli-loop#1219: Modifies InputVisualizationCanvasPrefabTests.cs to add missing-script detection via prefab hierarchy traversal, overlapping with the prefab validation infrastructure added here.
  • hatayama/unity-cli-loop#1208: Touches InputVisualizationCanvas.cs and related tests to add runtime reference restoration and instantiation validation in the same subsystem.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: preventing editor-only input visualization and code-analysis components from being included in player builds.
Description check ✅ Passed The description is directly related to the changeset, detailing user impact, changes made, and verification steps for excluding editor-only tooling from player builds.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feature/hatayama/fix-mouse-simulation-build

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 and usage tips.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 32 files

Re-trigger cubic

@hatayama
hatayama merged commit ff6fb8d into v3-beta May 27, 2026
8 checks passed
@hatayama
hatayama deleted the feature/hatayama/fix-mouse-simulation-build branch May 27, 2026 16:49
@github-actions github-actions Bot mentioned this pull request May 27, 2026
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