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.
@ReaperMaga

Copy link
Copy Markdown

Will this be merged at some point?

@inflicti0n

Copy link
Copy Markdown

Having the same error, thanks for the PR but when will this be merged?

@Scrolen

Scrolen commented Jul 24, 2026

Copy link
Copy Markdown
Author

Will this be merged at some point?

Having the same error, thanks for the PR but when will this be merged?

I do not have permissions to merge. You can clone the branch and use it, or pull from my fork
https://github.com/Scrolen/FishNet/tree/fix/unity-6-5-entityid-scenehandle

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.

3 participants