private void OnSelectionChanged(IRuntimeSelection selection, Object[] unselectedObjects) { if (unselectedObjects != null) { Renderer[] renderers = unselectedObjects.Select(go => go as GameObject).Where(go => go != null).SelectMany(go => go.GetComponentsInChildren <Renderer>(true)).ToArray(); m_outlineEffect.RemoveRenderers(renderers); } TryToAddRenderers(selection); }
private void TryToRemoveRenderers(Object[] unselectedObjects) { if (unselectedObjects != null) { Renderer[] renderers = unselectedObjects.Select(go => go as GameObject).Where(go => go != null).SelectMany(go => go.GetComponentsInChildren <Renderer>(true)).ToArray(); m_outlineEffect.RemoveRenderers(renderers); ICustomOutlinePrepass[] customRenderers = unselectedObjects.Select(go => go as GameObject).Where(go => go != null).SelectMany(go => go.GetComponentsInChildren <ICustomOutlinePrepass>(true)).ToArray(); m_outlineEffect.RemoveRenderers(customRenderers); } }