Skip to content

Fix Unity 6.5 SceneHandle and Object ID compile errors#1051

Open
Scrolen wants to merge 1 commit into
FirstGearGames:mainfrom
Scrolen:fix/unity-6-5-entityid-scenehandle
Open

Fix Unity 6.5 SceneHandle and Object ID compile errors#1051
Scrolen wants to merge 1 commit into
FirstGearGames:mainfrom
Scrolen:fix/unity-6-5-entityid-scenehandle

Conversation

@Scrolen

@Scrolen Scrolen commented Jun 22, 2026

Copy link
Copy Markdown

Summary

This PR fixes Unity 6.5 compilation errors caused by obsolete Unity APIs that are now treated as compile-breaking errors.

Unity 6.5 reports direct Object.GetInstanceID() usage as obsolete and recommends GetEntityId(), and deprecates implicit SceneHandle conversions to/from int in favor of GetRawData() and FromRawData().

Changes

  • Added UnityCompatibility helper methods for Unity-version-safe access to:
    • UnityEngine.Object runtime IDs
    • raw SceneHandle values
    • SceneHandle construction from raw data
  • Replaced obsolete SceneHandle implicit int conversions with raw handle access.
  • Updated scene lookup/comparison code to use raw scene handles.
  • Updated unloaded scene tracking to avoid obsolete handle conversions.
  • Removed reliance on GetInstanceID() < 0 for observer condition cleanup and replaced it with explicit runtime-instance tracking.

Validation

Tested in Unity 6000.5.0f1.

Validation performed:

  • Project compiles with zero errors.
  • Host/client connection succeeds using Tugboat.
  • Client disconnect/reconnect succeeds.
  • Global network scene loading works.
  • Global network scene unloading works while clients are connected.
  • Late-joining client correctly receives currently loaded global network scene.

Adds a Unity compatibility helper for SceneHandle and UnityEngine.Object runtime IDs, replacing obsolete SceneHandle int conversions and Object.GetInstanceID usage that fail compilation in Unity 6.5.

Also removes reliance on GetInstanceID sign checks when cleaning up runtime observer condition instances.

Validated in Unity 6000.5.0f1 with zero compile errors, host/client connection, reconnect, global scene load/unload, and late client global scene synchronization.
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