Exception in GhostAnimationControllerInterpolationSystem

So I ran into a fun™ problem where my client prefab was instantiated into a scene, and then the scene was unloaded. This had the knock-on effect of causing exception spam from GhostAnimationControllerInterpolationSystem.

var go = m_GhostPresentationGameObjectSystem.GetGameObjectForEntity(EntityManager, entity);
var ctrl = go?.GetComponent<GhostAnimationController>();
if (ctrl != null)
    ctrl.CopyFromEntities();

The go?.GetComponent was throwing an ObjectAlreadyDestroyed (or something) exception. Usually, Visual Studio warns against using the ?. operator on Unity objects, specifically to avoid this situation.

On this note, it would be nice if that system didn’t run if there were no gameobjects with the GhostAnimationController component.

@CMarastoni @NikiWalker just to make sure you guys didn’t miss this :slight_smile:

Yup, thanks for reporting!

1 Like