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;
}