Fix/input fix main#1998
Conversation
Declare com.unity.inputsystem (>= 1.7.0) in package.json and restore the Unity.InputSystem GUID reference in MapboxExamples.asmdef. Together these let the Examples assembly compile under every Active Input Handling combination without scene edits or per-project setup. PointerInput.cs now gates its #if on Unity's built-in ENABLE_INPUT_SYSTEM (driven by Player → Active Input Handling), not MAPBOX_NEW_INPUT_SYSTEM (driven by package presence). This is the critical lever for preserving existing legacy-input projects: when those projects update the SDK, UPM auto-installs the input system package but Unity does not change Player Settings, so ENABLE_INPUT_SYSTEM stays unset and the legacy #else branch keeps compiling. Runtime behavior is unchanged for those users until they explicitly opt in to the new input system via the Active Input Handling setting. Drops the now-unused MAPBOX_NEW_INPUT_SYSTEM versionDefines block.
Add v3.1.1 changelog entry covering why the package dependency was reclassified from soft to hard, what changed in PointerInput.cs's #if gate, and how to recover if upgrading an existing project hits a snag (stale Library cache, manifest pinning, "New only" UGUI exception, manual physical removal). The 3.1.0 entry is left intact as the historical record.
There was a problem hiding this comment.
Pull request overview
This PR updates the SDK’s example input backend selection to follow Unity’s Player Settings → Active Input Handling (via ENABLE_INPUT_SYSTEM) and makes com.unity.inputsystem an explicit UPM dependency so Unity 6+ projects no longer fail to compile due to mismatched package/asmdef expectations.
Changes:
- Switched input-system compile gating from
MAPBOX_NEW_INPUT_SYSTEM(package-presence) to Unity’s built-inENABLE_INPUT_SYSTEM(Player Settings driven). - Declared
com.unity.inputsystem@1.7.0as a package dependency and updated the Examples asmdef accordingly. - Updated README/docs/changelog and bumped package version to
3.1.1.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Runtime/Mapbox/Example/Scripts/PointerInput.cs | Uses ENABLE_INPUT_SYSTEM to select the correct input backend based on Active Input Handling. |
| Runtime/Mapbox/Example/MapboxExamples.asmdef | Removes versionDefines and adds an Input System assembly reference for the Examples assembly. |
| README.md | Updates dependency table and clarifies input backend selection behavior. |
| package.json | Bumps version to 3.1.1 and adds com.unity.inputsystem@1.7.0 dependency. |
| Documentation~/Migration-3.0-to-3.1.md | Updates migration notes to reflect the new hard dependency and selection mechanism. |
| Documentation~/CameraSystem.md | Updates Input System support section to describe Player Settings–based selection. |
| CHANGELOG.md | Adds v3.1.1 notes explaining the compilation fix and new dependency model. |
| .gitignore | Ignores local Claude configuration files/directories. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "GUID:6055be8ebefd69e48b49212b09b47b2f", | ||
| "GUID:8ba268152fd3143f59445711358cb12f" | ||
| "GUID:8ba268152fd3143f59445711358cb12f", | ||
| "GUID:75469ad4d38634e559750d17036d5f7c" |
| /// so the rest of the camera/input layer stays free of #if branching. | ||
| /// has exactly one of two implementations compiled in, selected by Unity's | ||
| /// built-in <c>ENABLE_INPUT_SYSTEM</c> define (set when Active Input Handling | ||
| /// in Player Settings is "New" or "Both"). Gating on <c>ENABLE_INPUT_SYSTEM</c> |
flasher297
left a comment
There was a problem hiding this comment.
Things worth flagging:
-
package.jsonformatting inconsistency (pre-existing, not introduced here, but now touched). Thedependenciesblock mixes spaces and tabs ("com.unity.render-pipelines.universal"uses spaces,com.unity.nuget.newtonsoft-jsonandcom.unity.burstuse tabs). The newcom.unity.inputsystemline uses a tab, consistent with its neighbors, so this PR doesn't make it worse — but since the file is being edited anyway, this would've been a cheap opportunity to normalize. -
Missing trailing newline in
MapboxExamples.asmdef(\ No newline at end of file) — pre-existing, not this PR's fault, but flagging since the diff touches the last line. -
Version floor choice.
1.7.0is pinned as the minimum forcom.unity.inputsystem. Worth double-checking against actual API usage (Mouse.current,EnhancedTouch.Touch,TouchPhase) — ifEnhancedTouchrequires manualEnhancedTouchSupport.Enable()calls that were added/changed in later minor versions, confirm 1.7.0 is genuinely sufficient rather than an arbitrary "known good" number. -
UGUI
InvalidOperationExceptioncaveat is a real, separate landmine. The changelog is upfront thatStandaloneInputModulebreaks under Active-Input = "New"-only, requiring a manualInputSystemUIInputModuleswap. That's good, honest documentation — but it means this PR only fixes compilation, not full runtime UGUI compatibility under "New" mode. Worth confirming this is explicitly out of scope rather than an oversight, since users following the docs to "New" could still hit a runtime exception the PR doesn't touch. -
No test/CI changes in the diff. Given this is fixing a Unity-6-specific compile break, it'd be good to confirm (outside this diff) that CI actually builds against a Unity 6 target with default Active Input Handling — otherwise this exact regression could resurface undetected.
-
Physical-removal escape hatch in the changelog (editing
package.json+ asmdef GUID to fully remove the dependency) is a reasonable pressure-release for users who object to a hard dependency, but it's brittle/unsupported by design — fine as documented, just worth being aware support requests may follow.
Overall: correct, well-reasoned fix for a legitimate compile-breaking bug, with unusually thorough changelog/migration documentation. I'd approve with the version-floor and CI-coverage points as follow-ups rather than blockers.
Summary:
On newer Unity projects (Unity 6 and up), this package failed to compile because of how we handled the optional Input System package. This PR makes the dependency explicit and reliable, so the SDK now builds correctly regardless of which input setup a project uses.
What changed:
com.unity.inputsystem is now a proper package dependency, so Unity always installs it alongside the SDK.
Input handling now follows the project's own Player Settings (Active Input Handling) instead of guessing based on whether a package happens to be installed.
Updated docs/README to match the new behavior.
Impact on existing projects:
No action needed. Projects using the old (legacy) input setup will keep working exactly as before — this only fixes projects that were previously broken by the compile error.
Bumped to v3.1.1 with changelog notes for anyone upgrading.
@flasher297