From 72bcfc698848e1efa697b4728dcff0d5e1c935e8 Mon Sep 17 00:00:00 2001 From: Baran Kahyaoglu Date: Tue, 9 Jun 2026 09:16:09 +0300 Subject: [PATCH 1/4] Add com.unity.inputsystem as a package dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Runtime/Mapbox/Example/MapboxExamples.asmdef | 11 +++-------- Runtime/Mapbox/Example/Scripts/PointerInput.cs | 17 +++++++++++------ package.json | 3 ++- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Runtime/Mapbox/Example/MapboxExamples.asmdef b/Runtime/Mapbox/Example/MapboxExamples.asmdef index bc8aeb621..35e1e9a75 100644 --- a/Runtime/Mapbox/Example/MapboxExamples.asmdef +++ b/Runtime/Mapbox/Example/MapboxExamples.asmdef @@ -8,7 +8,8 @@ "GUID:36ca6af6e2b304d4090888554d6ce199", "GUID:1b64b068a01f943108c7f4b7a5356c7a", "GUID:6055be8ebefd69e48b49212b09b47b2f", - "GUID:8ba268152fd3143f59445711358cb12f" + "GUID:8ba268152fd3143f59445711358cb12f", + "GUID:75469ad4d38634e559750d17036d5f7c" ], "includePlatforms": [], "excludePlatforms": [], @@ -17,12 +18,6 @@ "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], - "versionDefines": [ - { - "name": "com.unity.inputsystem", - "expression": "", - "define": "MAPBOX_NEW_INPUT_SYSTEM" - } - ], + "versionDefines": [], "noEngineReferences": false } \ No newline at end of file diff --git a/Runtime/Mapbox/Example/Scripts/PointerInput.cs b/Runtime/Mapbox/Example/Scripts/PointerInput.cs index 41ebe0a8c..af28a2fe8 100644 --- a/Runtime/Mapbox/Example/Scripts/PointerInput.cs +++ b/Runtime/Mapbox/Example/Scripts/PointerInput.cs @@ -1,5 +1,5 @@ using UnityEngine; -#if MAPBOX_NEW_INPUT_SYSTEM +#if ENABLE_INPUT_SYSTEM using UnityEngine.InputSystem; using NewTouch = UnityEngine.InputSystem.EnhancedTouch.Touch; using NewTouchPhase = UnityEngine.InputSystem.TouchPhase; @@ -24,10 +24,15 @@ internal enum PointerTouchPhase /// /// Thin abstraction over Unity's two input backends. - /// has exactly one of two implementations compiled in, selected by the - /// MAPBOX_NEW_INPUT_SYSTEM define (which the asmdef's versionDefines sets when - /// com.unity.inputsystem is installed). MapInput.cs talks only to this interface, - /// 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 ENABLE_INPUT_SYSTEM define (set when Active Input Handling + /// in Player Settings is "New" or "Both"). Gating on ENABLE_INPUT_SYSTEM + /// rather than package presence is intentional: com.unity.inputsystem is + /// a hard dependency of this package, so it's always installed, but existing + /// legacy-input projects must keep running the #else branch until the + /// user explicitly opts in via Active Input Handling. MapInput.cs talks only + /// to this interface, so the rest of the camera/input layer stays free of + /// #if branching. /// internal interface IPointerInput { @@ -62,7 +67,7 @@ internal interface IPointerInput float MouseScrollY { get; } } -#if MAPBOX_NEW_INPUT_SYSTEM +#if ENABLE_INPUT_SYSTEM internal sealed class PointerInput : IPointerInput { public void EnableTouchSupport() diff --git a/package.json b/package.json index 6b12bb2e9..546905b30 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "dependencies": { "com.unity.render-pipelines.universal": "10.10.1", "com.unity.nuget.newtonsoft-json": "3.2.1", - "com.unity.burst": "1.8.12" + "com.unity.burst": "1.8.12", + "com.unity.inputsystem": "1.7.0" }, "author": { "name": "Mapbox", From df3c4615be027a092680153e8c1c726c20025dbe Mon Sep 17 00:00:00 2001 From: Baran Kahyaoglu Date: Tue, 9 Jun 2026 09:16:12 +0300 Subject: [PATCH 2/4] Ignore Claude Code local config (CLAUDE.md, .claude/) --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 8bafea12a..cf9896f42 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,8 @@ Runtime/Mapbox/VectorModule/MeshGeneration/.idea # Internal benchmark tool, kept local-only Runtime/Mapbox/Example/Scripts/TileProviderBenchmark.cs Runtime/Mapbox/Example/Scripts/TileProviderBenchmark.cs.meta + +# Claude Code local config, kept local-only +CLAUDE.md +CLAUDE.md.meta +.claude/ From be8a4a1a35b3539f53f4171c5fcd2893a3c6781c Mon Sep 17 00:00:00 2001 From: Baran Kahyaoglu Date: Tue, 9 Jun 2026 09:39:36 +0300 Subject: [PATCH 3/4] Bump to 3.1.1, document input-system dependency change 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. --- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1846a60e8..525a53a35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ ## CHANGELOG +### v3.1.1 + +Patch release. Reclassifies `com.unity.inputsystem` from a soft to a **hard** package dependency and switches the example-assembly `#if` gate from package presence to Player Settings, restoring compilation on Unity 6+ projects where the input system package ships preinstalled. Existing legacy-input projects updating from 3.1.0 see no runtime behavior change. + +#### Why this exists + +In 3.1.0 the SDK declared `com.unity.inputsystem` as a soft dependency: source code branched on a `MAPBOX_NEW_INPUT_SYSTEM` define wired via `versionDefines` (set when the package is installed), but `MapboxExamples.asmdef` did not actually reference `Unity.InputSystem`. On Unity 6+ — where the input system package is installed by default — the `#if MAPBOX_NEW_INPUT_SYSTEM` branch activated, the `using UnityEngine.InputSystem` failed to resolve at the asmdef level, and the entire Examples assembly failed to compile. + +The mirror failure mode (asmdef referencing `Unity.InputSystem` without the package installed → unresolved-reference compile error in 2022.3 legacy projects) ruled out simply restoring the reference. Source-side `#if` cannot bridge this because asmdef reference resolution happens before C# preprocessing. + +This release resolves the trade-off by treating the package as a hard dependency that's always installed, and gating the source-side branch on a Unity built-in define that's only set when the user explicitly opts in via Player Settings. + +#### Changed + +- `com.unity.inputsystem` (>= 1.7.0) is declared in `package.json` `dependencies`. UPM auto-installs it on next package refresh. The package coexists with legacy input; installation alone does not change runtime behavior. +- `PointerInput.cs` now gates on Unity's built-in `ENABLE_INPUT_SYSTEM` define (set by Player → Active Input Handling = "New" or "Both") instead of `MAPBOX_NEW_INPUT_SYSTEM`. Existing legacy-input projects keep running the `#else` branch until the user explicitly switches Active Input Handling. +- `MapboxExamples.asmdef` references `Unity.InputSystem` directly and drops the `MAPBOX_NEW_INPUT_SYSTEM` `versionDefines` block (no longer used). + +#### Upgrading an existing project + +For the common case — Unity 2022.3 project, Active Input Handling = "Old", no prior `com.unity.inputsystem` install — no action is required. After the SDK update, UPM installs the input system package (~2 MB), Active Input Handling stays "Old", and every code path runs the same legacy implementation it did before. + +If the upgrade goes wrong, in roughly decreasing order of likelihood: + +- **Stale compile errors that mention `UnityEngine.InputSystem` or `MAPBOX_NEW_INPUT_SYSTEM`** — Unity's `Library/` cache hasn't picked up the new package. Close Unity, delete `Library/`, reopen. Unity re-resolves packages and reimports. +- **Package Manager reports "cannot resolve com.unity.inputsystem"** — the project is on Unity < 2022.3, which the SDK does not support, or a project-side `Packages/manifest.json` override pins an incompatible version. Bump the project's Unity version or relax the version constraint. +- **Map cameras stop responding to mouse / touch after the update** — should not happen if Active Input Handling matches what it was before; if it does, verify Project Settings → Player → Active Input Handling is still set to your prior choice. Unity does not change this setting when a package is auto-installed, but a manual setting flip during the update would explain the symptom. +- **Yellow Inspector warning on `StandaloneInputModule` asking to "Replace with InputSystemUIInputModule"** — cosmetic, appears only under Active Input Handling = "New" / "Both". One-click swap on the EventSystem inspector if you want to clear it; runtime is unaffected. +- **UGUI throws `InvalidOperationException: You are trying to read Input using the UnityEngine.Input class…` under Active Input Handling = "New" only** — Unity's default `StandaloneInputModule` reads through `UnityEngine.Input.*`, which throws under New-only. Either set Active Input Handling to "Both" (legacy stays available for UGUI), or click "Replace with InputSystemUIInputModule" on the EventSystem inspector. +- **You want to remove `com.unity.inputsystem` entirely from your project** — UPM blocks removal because the SDK declares it as a dependency. The de facto opt-out is to leave it installed and set Active Input Handling = "Old"; the package is then dead weight on disk but runtime is identical to legacy-only. For a true physical removal, edit the SDK's `package.json` to drop the `com.unity.inputsystem` line and remove the matching GUID reference from `MapboxExamples.asmdef`. Requires the SDK to be in an editable location (e.g. embedded under `Packages/`, not in `Library/PackageCache/`). + ### v3.1.0 Minor-version bump per semver: this release contains source-breaking API changes (listed below) alongside substantial feature work in camera/input, tile LOD, and terrain rendering. The 3.0.7 designation was previously used in development; published 3.0.7 builds, if any, are superseded by 3.1.0. diff --git a/package.json b/package.json index 546905b30..42de87f75 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.mapbox.sdk", - "version": "3.1.0", + "version": "3.1.1", "displayName": "Mapbox Unity SDK", "description": "Mapbox Unity SDK", "unity": "2022.3", From 7863306ecec34b33791a04407194a4dad0c6d9b4 Mon Sep 17 00:00:00 2001 From: Baran Kahyaoglu Date: Tue, 7 Jul 2026 15:39:26 +0300 Subject: [PATCH 4/4] update the documents --- Documentation~/CameraSystem.md | 8 ++++---- Documentation~/Migration-3.0-to-3.1.md | 2 +- README.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation~/CameraSystem.md b/Documentation~/CameraSystem.md index 4b4ff0301..61282d3e1 100644 --- a/Documentation~/CameraSystem.md +++ b/Documentation~/CameraSystem.md @@ -102,12 +102,12 @@ Zoom at cursor works with both mouse and touch — when using pinch, the zoom ce ## Input System Support -The cameras work with both Unity's legacy Input Manager and the new Input System package. The active path is selected at compile time: +The cameras work with both Unity's legacy Input Manager and the new Input System package. `com.unity.inputsystem` is a hard dependency of the SDK (UPM installs it automatically), but the active code path is selected by Player Settings, not by package presence: -- **Default (no Input System package installed)** — uses the legacy `UnityEngine.Input` API. No action needed. -- **With `com.unity.inputsystem` installed** — the example asmdef declares a `versionDefines` entry that automatically defines `MAPBOX_NEW_INPUT_SYSTEM`. The new-input branch activates and reads pointer state via `Mouse.current` / `Touch.activeTouches`. +- **Active Input Handling = "Input Manager (Old)" (default)** — uses the legacy `UnityEngine.Input` API. No action needed, and this is unchanged by the package being installed. +- **Active Input Handling = "Input System Package (New)" or "Both"** — Unity defines the built-in `ENABLE_INPUT_SYSTEM` symbol, which activates the new-input branch. Pointer state is read via `Mouse.current` / `Touch.activeTouches`. -The Input System package is *not* a hard dependency of the SDK — projects that don't install it keep the legacy path with no extra setup. Projects that set **Active Input Handling** to "Input System Package (New)" only must install the package; otherwise `UnityEngine.Input` is unavailable at runtime. +Installing `com.unity.inputsystem` alone does not change which path runs — only flipping Active Input Handling does. See the [CHANGELOG](../CHANGELOG.md#v311) for why the SDK moved from a soft dependency gated on package presence to this model. --- diff --git a/Documentation~/Migration-3.0-to-3.1.md b/Documentation~/Migration-3.0-to-3.1.md index f7672d44d..bb9d6db02 100644 --- a/Documentation~/Migration-3.0-to-3.1.md +++ b/Documentation~/Migration-3.0-to-3.1.md @@ -23,7 +23,7 @@ The new dependency is resolved automatically by UPM: | Dependency | Status | Why | | --- | --- | --- | | `com.unity.burst@1.8.12` | **New required dep** | Terrain-RGB decode and collider vertex fill are now Burst jobs. | -| `com.unity.inputsystem` | **Soft dep (unchanged)** | If installed, the SDK auto-uses the new Input System via a `MAPBOX_NEW_INPUT_SYSTEM` define from `versionDefines`. If absent, the SDK falls back to legacy `UnityEngine.Input`. No project-side action either way. | +| `com.unity.inputsystem@1.7.0` | **New required dep (as of v3.1.1)** | Hard dependency, auto-installed by UPM. Which input path runs is controlled by Player Settings → Active Input Handling, not by package presence — see [CameraSystem.md](CameraSystem.md#input-system-support). Projects on "Input Manager (Old)" (the default) see no behavior change. | --- diff --git a/README.md b/README.md index 121428dec..3c1664dbd 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Resolved automatically by UPM: | `com.unity.render-pipelines.universal` | `10.10.1` | Yes | Terrain and building shaders ship as URP Shader Graphs. | | `com.unity.nuget.newtonsoft-json` | `3.2.1` | Yes | JSON parsing for tile metadata and API responses. | | `com.unity.burst` | `1.8.12` | Yes | Burst-compiled terrain decode and collider job. First-time domain reload pays a one-shot AOT compile. | -| `com.unity.inputsystem` | any | Optional | If installed, camera input uses the new Input System (auto-set `MAPBOX_NEW_INPUT_SYSTEM` define). If absent, falls back to legacy `UnityEngine.Input`. | +| `com.unity.inputsystem` | `1.7.0` | Yes | Camera input backend selection is controlled by Player Settings → Active Input Handling, not by this dependency; "Old" (default) keeps legacy `UnityEngine.Input` behavior. See `Documentation~/CameraSystem.md`. | ---