Skip to content

fix: Linux editor discovery + Unity 6000.5 EntityId compat#2

Merged
mflRevan merged 1 commit into
mflRevan:mainfrom
erasmus74:fix/linux-unity-6000-5-compat
Jun 10, 2026
Merged

fix: Linux editor discovery + Unity 6000.5 EntityId compat#2
mflRevan merged 1 commit into
mflRevan:mainfrom
erasmus74:fix/linux-unity-6000-5-compat

Conversation

@erasmus74

Copy link
Copy Markdown
Contributor

Summary

Two fixes that were both needed to get ucp connect working on Linux with Unity 6000.5.0b11.

1. CLI: Linux editor install root discovery

unity_install_roots() only had #[cfg(windows)] paths — on Linux it returned an empty Vec, so UCP could never locate any installed Unity editors regardless of where they were installed.

Added #[cfg(unix)] block searching standard Linux Unity Hub install locations:

  • ~/Unity/Hub/Editor/
  • ~/.local/share/Unity/Hub/Editor/
  • ~/.unityhub/Editor/
  • /opt/Unity/Hub/Editor/
  • /usr/local/Unity/Hub/Editor/
  • XDG secondaryInstallPath.json from ~/.config/unityhub/

Fixed read_hub_project_version() which was hardcoded to %APPDATA%/UnityHub/projects-v1.json. Extracted a hub_projects_path() helper with platform-aware logic and fixed project key matching (no backslash conversion on Linux).

2. Bridge: Unity 6000.5 deprecated API errors

Unity 6000.5.0b11 elevated several obsolete APIs to compiler errors (CS0619):

Deprecated API Replacement
Object.GetInstanceID() GetEntityId() + EntityId.ToULong()
EditorUtility.InstanceIDToObject(int) EditorUtility.EntityIdToObject(EntityId)
EditorSettings.externalVersionControl VersionControlSettings.mode
(int)SceneHandle SceneHandle.GetRawData()

Updated UnityObjectCompat.cs with #if UNITY_6000_5_OR_NEWER guards using EntityId.ToULong/FromULong for lossless int round-tripping. Migrated all 10 controller files, the compat layer, and tests to use the compat abstraction.

Testing

  • ucp connect successfully launches Unity 6000.5.0b11 on Linux (Ubuntu)
  • ucp doctor — all checks pass
  • ucp editor status — correctly lists all 4 installed editor versions
  • ucp scene active — returns correct scene info
  • Bridge compiles and connects with zero errors

Files changed

  • cli/src/editor_runtime.rs — Linux install roots + cross-platform hub config paths
  • unity-package/com.ucp.bridge/Editor/Compatibility/UnityObjectCompat.cs — EntityId compat layer
  • 10 controller files + tests — migrated to compat layer

@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

@erasmus74 is attempting to deploy a commit to the mflrevan's projects Team on Vercel.

A member of the Team first needs to authorize it.

CLI: Add Linux editor install root discovery

The unity_install_roots() function only had Windows-specific paths
guarded by #[cfg(windows)], so on Linux it returned an empty Vec and
UCP could never find any installed Unity editors.

Added #[cfg(unix)] block that searches:
  - ~/Unity/Hub/Editor/
  - ~/.local/share/Unity/Hub/Editor/
  - ~/.unityhub/Editor/
  - /opt/Unity/Hub/Editor/
  - /usr/local/Unity/Hub/Editor/
  - XDG_CONFIG_HOME/unityhub/secondaryInstallPath.json
  - ~/.config/unityhub/secondaryInstallPath.json

Also fixed read_hub_project_version() which was hardcoded to
%APPDATA%/UnityHub/projects-v1.json (Windows-only). Extracted
hub_projects_path() helper with platform-aware logic and fixed
the project key matching (no backslash conversion on Linux).

Bridge: Adapt to Unity 6000.5 deprecated API errors

Unity 6000.5.0b11 elevated several obsolete APIs to compiler errors
(CS0619):
  - Object.GetInstanceID() -> GetEntityId()
  - EditorUtility.InstanceIDToObject() -> EntityIdToObject()
  - EditorSettings.externalVersionControl -> VersionControlSettings.mode
  - SceneHandle implicit int conversion -> GetRawData()

Updated UnityObjectCompat.cs with #if UNITY_6000_5_OR_NEWER guards
using EntityId.ToULong/FromULong for lossless int round-tripping, and
migrated all controller files and tests to use the compat layer.
@erasmus74 erasmus74 force-pushed the fix/linux-unity-6000-5-compat branch from 5b6f82e to e9f687b Compare June 7, 2026 20:43
@mflRevan mflRevan merged commit 9b65a58 into mflRevan:main Jun 10, 2026
1 check failed
mflRevan added a commit that referenced this pull request Jun 10, 2026
fix: add missing AssemblyInfo.cs.meta

The Linux/6000.5 compat PR (#2) added Editor/AssemblyInfo.cs without a
committed .meta file. Every other .cs in the package ships a tracked
.meta, so without it Unity would generate a fresh random GUID on each
UPM consumer, producing a spurious dirty diff. Add it to restore the
repo convention.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@
mflRevan added a commit that referenced this pull request Jun 10, 2026
The Linux/6000.5 compat PR (#2) added Editor/AssemblyInfo.cs without a
committed .meta file. Every other .cs in the package ships a tracked
.meta, so without it Unity would generate a fresh random GUID on each
UPM consumer, producing a spurious dirty diff. Add it to restore the
repo convention.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mflRevan added a commit that referenced this pull request Jun 10, 2026
…yId compat

PR #2's EntityId work widened GetSceneHandle's return type to long and, in the
pre-6000.5 (#else) branch, returned Scene.handle directly. On Unity 6000.0-6000.4
Scene.handle is a SceneHandle with implicit int and uint operators, so widening
straight to long is ambiguous (CS0457) and the entire editor bridge failed to
compile across the 6.0-6.4 support matrix. Pin the int conversion explicitly --
handles are 32-bit on these versions, so it is lossless.

Validated by running the editmode suite on 6000.4.0f1 (compiles clean, tests pass).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants