Summary
com.akiojin.unity-cli-bridge fails to compile in Unity 6.5 because several editor-side bridge scripts still call UnityEngine.Object.GetInstanceID().
In Unity 6.5, Object.GetInstanceID() is now obsolete and Unity reports it as a CS0619 compile error:
Object.GetInstanceID() is obsolete: GetInstanceID is deprecated. Use GetEntityId instead. This will be removed in a future version.
Because the bridge package uses GetInstanceID() in multiple handlers and helper classes, the Unity project cannot finish compiling after the package is imported.
Environment
- Unity version: Unity 6.5 / 6000.5.x
- Package:
com.akiojin.unity-cli-bridge
- Package source/hash shown in PackageCache:
3a41bf6dc060
- Install method: Unity Package Manager / Git package
- OS: macOS
- Project type: Unity 6.5 project using
akiojin/unity-cli
Steps to reproduce
- Open a Unity 6.5 project.
- Add
com.akiojin.unity-cli-bridge from this repository.
- Let Unity import and compile the package.
- Check the Unity Console.
Actual result
Unity compilation fails with CS0619 errors from unity-cli-bridge:
Library/PackageCache/com.akiojin.unity-cli-bridge@3a41bf6dc060/Editor/Helpers/RuntimeChangeJournal.cs(39,22): error CS0619: 'Object.GetInstanceID()' is obsolete: 'GetInstanceID is deprecated. Use GetEntityId instead. This will be removed in a future version.'
Library/PackageCache/com.akiojin.unity-cli-bridge@3a41bf6dc060/Editor/Handlers/GameObjectHandler.cs(105,26): error CS0619: 'Object.GetInstanceID()' is obsolete: 'GetInstanceID is deprecated. Use GetEntityId instead. This will be removed in a future version.'
Library/PackageCache/com.akiojin.unity-cli-bridge@3a41bf6dc060/Editor/Handlers/GameObjectHandler.cs(381,26): error CS0619: 'Object.GetInstanceID()' is obsolete: 'GetInstanceID is deprecated. Use GetEntityId instead. This will be removed in a future version.'
Library/PackageCache/com.akiojin.unity-cli-bridge@3a41bf6dc060/Editor/Handlers/GameObjectHandler.cs(468,26): error CS0619: 'Object.GetInstanceID()' is obsolete: 'GetInstanceID is deprecated. Use GetEntityId instead. This will be removed in a future version.'
Library/PackageCache/com.akiojin.unity-cli-bridge@3a41bf6dc060/Editor/Handlers/ComponentHandler.cs(2030,30): error CS0619: 'Object.GetInstanceID()' is obsolete: 'GetInstanceID is deprecated. Use GetEntityId instead. This will be removed in a future version.'
Library/PackageCache/com.akiojin.unity-cli-bridge@3a41bf6dc060/Editor/Handlers/SceneAnalysisHandler.cs(393,38): error CS0619: 'Object.GetInstanceID()' is obsolete: 'GetInstanceID is deprecated. Use GetEntityId instead. This will be removed in a future version.'
Library/PackageCache/com.akiojin.unity-cli-bridge@3a41bf6dc060/Editor/Handlers/SelectionHandler.cs(272,33): error CS0619: 'Object.GetInstanceID()' is obsolete: 'GetInstanceID is deprecated. Use GetEntityId instead. This will be removed in a future version.'
Expected result
The bridge package should compile successfully in Unity 6.5.
Suspected cause
Unity 6.5 deprecates UnityEngine.Object.GetInstanceID() and requires UnityEngine.Object.GetEntityId() instead.
The affected bridge code appears to expose or store Unity object identifiers as int values returned by GetInstanceID(), for example in:
RuntimeChangeJournal.cs
GameObjectHandler.cs
ComponentHandler.cs
SceneAnalysisHandler.cs
SelectionHandler.cs
Suggested fix
Please consider migrating the bridge from Object.GetInstanceID() to Object.GetEntityId() for Unity 6.5 compatibility.
A simple GetEntityId().GetHashCode() replacement may not be ideal if the value is used as a stable or unique object identifier, because EntityId is no longer guaranteed to be representable as a single int going forward. It may be safer to:
- use
EntityId directly internally where possible,
- update response DTOs/protocol fields that currently assume
int id,
- use
EntityId.None / validity checks instead of 0-based instance ID assumptions,
- add conditional compilation if older Unity versions still need to be supported.
For example, the bridge may need a compatibility layer around object identifiers instead of directly returning GetInstanceID() from each handler.
References
Thank you for maintaining unity-cli. This tool is very useful for Unity editor automation workflows, and Unity 6.5 compatibility would be greatly appreciated.
Summary
com.akiojin.unity-cli-bridgefails to compile in Unity 6.5 because several editor-side bridge scripts still callUnityEngine.Object.GetInstanceID().In Unity 6.5,
Object.GetInstanceID()is now obsolete and Unity reports it as a CS0619 compile error:Because the bridge package uses
GetInstanceID()in multiple handlers and helper classes, the Unity project cannot finish compiling after the package is imported.Environment
com.akiojin.unity-cli-bridge3a41bf6dc060akiojin/unity-cliSteps to reproduce
com.akiojin.unity-cli-bridgefrom this repository.Actual result
Unity compilation fails with CS0619 errors from
unity-cli-bridge:Expected result
The bridge package should compile successfully in Unity 6.5.
Suspected cause
Unity 6.5 deprecates
UnityEngine.Object.GetInstanceID()and requiresUnityEngine.Object.GetEntityId()instead.The affected bridge code appears to expose or store Unity object identifiers as
intvalues returned byGetInstanceID(), for example in:RuntimeChangeJournal.csGameObjectHandler.csComponentHandler.csSceneAnalysisHandler.csSelectionHandler.csSuggested fix
Please consider migrating the bridge from
Object.GetInstanceID()toObject.GetEntityId()for Unity 6.5 compatibility.A simple
GetEntityId().GetHashCode()replacement may not be ideal if the value is used as a stable or unique object identifier, becauseEntityIdis no longer guaranteed to be representable as a singleintgoing forward. It may be safer to:EntityIddirectly internally where possible,int id,EntityId.None/ validity checks instead of0-based instance ID assumptions,For example, the bridge may need a compatibility layer around object identifiers instead of directly returning
GetInstanceID()from each handler.References
Unity
Object.GetInstanceID()documentation:https://docs.unity3d.com/ScriptReference/Object.GetInstanceID.html
Unity
Object.GetEntityId()documentation:https://docs.unity3d.com/6000.4/Documentation/ScriptReference/Object.GetEntityId.html
Unity discussion about
GetInstanceID()/EntityIdmigration:https://discussions.unity.com/t/is-getentityid-gethashcode-a-direct-replacement-for-getinstanceid-if-only-for-the-time-being/1721711
Thank you for maintaining
unity-cli. This tool is very useful for Unity editor automation workflows, and Unity 6.5 compatibility would be greatly appreciated.