/// <summary>
/// <para>Returns the current selection filtered by type and mode.</para>
/// </summary>
/// <param name="type">Only objects of this type will be retrieved.</param>
/// <param name="mode">Further options to refine the selection.</param>
public static UnityEngine.Object[] GetFiltered(System.Type type, SelectionMode mode)
{
ArrayList arrayList = new ArrayList();
if (type == typeof(Component) || type.IsSubclassOf(typeof(Component)))
{
foreach (Component transform in Selection.GetTransforms(mode))
{
Component component = transform.GetComponent(type);
if ((bool)((UnityEngine.Object)component))
{
arrayList.Add((object)component);
}
}
}
else if (type == typeof(GameObject) || type.IsSubclassOf(typeof(GameObject)))
{
foreach (Transform transform in Selection.GetTransforms(mode))
{
arrayList.Add((object)transform.gameObject);
}
}
else
{
foreach (UnityEngine.Object @object in Selection.GetObjectsMode(mode))
{
if (@object != (UnityEngine.Object)null && (@object.GetType() == type || @object.GetType().IsSubclassOf(type)))
{
arrayList.Add((object)@object);
}
}
}
return((UnityEngine.Object[])arrayList.ToArray(typeof(UnityEngine.Object)));
}