Assertion Exception Upon Trying to Check reachedDestination for a Destroying Follower Entity

Hi all,
I’ve noticed that sometimes this error can pop up when I destroy a game object with a follower entity, and when I started trying to source the origin of the error I realized it’s probably linked to something with the processing of follower entities. The error is harmless in editor, but seems to cause a crash to desktop in a built app. I can probably work around it by using object pooling instead, but I thought I would make the issue known in case it affects others.
Here’s the relevant code:

public List<UnitMovement> GetArrivedPatrolUnits ()
{
    Cleanup(); //(Goes through and removes unitmovements of destroyed objects from the patrolUnits list. Unit movements are mainly a container for follower entities with a few helper methods for formation movement.)
    List<UnitMovement> arrivedUnits = new List<UnitMovement>();
    foreach (UnitMovement um in patrolUnits)
    {
        if (um.FEntity != null)
        {
            if (um.FEntity.reachedDestination)
            {
                arrivedUnits.Add(um);
            }
        }
    }
    return arrivedUnits;
}

Assertion Error

Hi

That looks like a bug in the entities package. I would recommend upgrading that package and trying again.

I have a unit test for checking reachedDestination after the agent has been destroyed, and that works perfectly with the latest entities package.

Hi Aron,
I’m not sure if this is the case, I’m on entities version 1.0.16 and as far as I can tell this is the latest version of the package.

https://docs.unity3d.com/Packages/com.unity.entities@1.2/changelog/CHANGELOG.html