Forum rules - please read before posting.

[Unity 6000.6] EntityId compile errors in HierarchyIcons.cs

Hi Chris,

I understand that Unity 6000.6 may not have been officially tested or supported by Adventure Creator yet, but we tried upgrading our project and found a small compatibility issue that I wanted to report early.

Environment:

  • Adventure Creator 1.86.5
  • Unity 6000.6.0f1
  • macOS / Apple Silicon

After opening the project in Unity 6000.6, compilation failed with these two errors:

Assets/AdventureCreator/Scripts/ActionList/Editor/HierarchyIcons.cs(165,24):
error CS0619: 'EntityId.implicit operator EntityId(int)' is obsolete:
'EntityId will not be representable by an int in the future.
This casting operator will be removed in a future version.'

Assets/AdventureCreator/Scripts/ActionList/Editor/HierarchyIcons.cs(187,22):
error CS0619: 'EntityId.implicit operator EntityId(int)' is obsolete:
'EntityId will not be representable by an int in the future.
This casting operator will be removed in a future version.'

Under UNITY_6000_5_OR_NEWER, actionListIDs and rememberIDs are declared as:

HashSet<EntityId>

However, GatherIDs() still adds values returned by:

UnityVersionHandler.GetInstanceID(gameObject)

This returns an int, so the code relies on the implicit int -> EntityId conversion. In Unity 6000.6 that conversion is now marked as an error instead of a warning.

We fixed it by using GameObject.GetEntityId() directly for Unity 6000.5 and newer, while keeping the existing path for older Unity versions:

#if UNITY_6000_5_OR_NEWER
    actionListIDs.Add(actionList.gameObject.GetEntityId());
#else
    actionListIDs.Add(UnityVersionHandler.GetInstanceID(actionList.gameObject));
#endif

And similarly for rememberIDs:

#if UNITY_6000_5_OR_NEWER
    rememberIDs.Add(constantID.gameObject.GetEntityId());
#else
    rememberIDs.Add(UnityVersionHandler.GetInstanceID(constantID.gameObject));
#endif

This is also consistent with the existing comparisons later in HierarchyItemCB(), which already use gameObject.GetEntityId() under UNITY_6000_5_OR_NEWER.

After applying these two changes, the Adventure Creator-related compilation errors were resolved successfully in Unity 6000.6.0f1.

I hope this compatibility fix can be included in a future Adventure Creator update.

Thanks!

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.