FMOD Event Reference Updater crashes on classes with a BlobAssetReference<Unity.Physics.Collider> member

I wanted to report that the FMOD Event Reference Updater crashes if my project has a BlobAssetReference<Unity.Physics.Collider> member in any of the MonoBehaviours that are assigned to a game object. Here is an example behaviour that will break the updater:

using UnityEngine;
using Unity.Physics;

public class AuthoringExample : MonoBehaviour
{
    private BlobAssetReference<Unity.Physics.Collider> ecsCollider;
}

This requires the Unity.Physics package to be installed. Tested on Physics 1.0.16 under Unity 2022.3.7. The crash reported is:

InvalidCastException: Specified cast is not valid.
Unity.Entities.BlobAssetReference1[T].Equals (System.Object obj) (at ./Library/PackageCache/com.unity.entities@1.0.16/Unity.Entities/Blobs.cs:708) System.Collections.Generic.ObjectEqualityComparer1[T].Equals (T x, T y) (at :0)
System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable1[T] source, TSource value, System.Collections.Generic.IEqualityComparer1[T] comparer) (at :0)
System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value) (at :0)
FMODUnity.EventReferenceUpdater+d__45.MoveNext () (at Assets/Plugins/3rd Party/FMOD/src/Editor/EventReferenceUpdater.cs:709)
FMODUnity.EventReferenceUpdater+d__45.MoveNext () (at Assets/Plugins/3rd Party/FMOD/src/Editor/EventReferenceUpdater.cs:711)
FMODUnity.EventReferenceUpdater+d__37.MoveNext () (at Assets/Plugins/3rd Party/FMOD/src/Editor/EventReferenceUpdater.cs:363)
FMODUnity.EventReferenceUpdater+d__34.MoveNext () (at Assets/Plugins/3rd Party/FMOD/src/Editor/EventReferenceUpdater.cs:256)
FMODUnity.EventReferenceUpdater.UpdateProcessing () (at Assets/Plugins/3rd Party/FMOD/src/Editor/EventReferenceUpdater.cs:1724)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <97436df440ca462884c5332c1d8ebbe7>:0)

Apologies for the delayed response, and thanks for pointing this out. I’ve been able to reproduce the issue on my end, and it seems to be an issue with a null check in EventReferenceUpdater running up against the cast in equality operator in Blobs.cs, as BlobAssetReference isn’t nullable.

Unfortunately, I don’t have a workaround to offer at present, but I’ve passed this along to the development team for further investigation. If this is a blocker or significant inconvenience for you, please let me know and I’ll see what I can do.

We have worked around the issue for now by ignoring any Entities related fields in the GetGenericUpdateTasks() function (around line 529).

foreach (FieldInfo f in fields)
{
    // New code to workaround the issue
    if (f.Module.Name == "Unity.Entities.dll")
        continue;

    // Remaining pre-existing code omitted
}

That’s great to hear. Thanks for providing your workaround, I’ve passed it along to the development team as well.