public static void Reset(Entity entity)
    {
        foreach (Entity clear in entitiesToClear)
        {
            if (clear != null && clear != entity)
            {
                clear.SetHighlight(Color.clear);
            }
        }
        entitiesToClear.Clear();
        entitiesToClear.UnionWith(targetEntities);

        targetEntities.Clear();
        currentTargetEntityI = -1;

        if (currentEntity != entity)
        {
            if (currentEntity != null)
            {
                // entity deselected
                currentEntity.SetHighlight(Color.clear);
                EntityPreviewManager.EntityDeselected();
            }
            if (entity != null)
            {
                // entity selected
                entity.SetHighlight(Color.white);
                EntityPreviewManager.EntitySelected(entity);
            }
        }
        currentEntity  = entity;
        behaviorTarget = null;
    }
 public static void Reset(Entity entity)
 {
     foreach (Entity target in targetEntities)
     {
         if (!(target is Substance))
         {
             continue;
         }
         ((Substance)target).highlight = Color.clear;
         ((Substance)target).UpdateHighlight();
     }
     if (currentEntity != entity)
     {
         if (currentEntity != null)
         {
             // entity deselected
             if (currentEntity is Substance)
             {
                 ((Substance)currentEntity).highlight = Color.clear;
                 ((Substance)currentEntity).UpdateHighlight();
             }
             EntityPreviewManager.EntityDeselected();
         }
         if (entity != null)
         {
             // entity selected
             if (entity is Substance)
             {
                 ((Substance)entity).highlight = Color.white;
                 ((Substance)entity).UpdateHighlight();
             }
             EntityPreviewManager.EntitySelected(entity);
         }
     }
     currentEntity  = entity;
     behaviorTarget = null;
     targetEntities.Clear();
     currentTargetEntityI = -1;
 }