Version: 2017.3
public static Object[] GetFiltered (Type type, SelectionMode mode);

Parámetros

type Solamente objetos de este tipo serán recuperados.
mode Unas opciones adicionales para re-definir la selección.

Descripción

Devuelve la selección actual filtrada por tipo y modo.

For a selected GameObject that has multiple Components of type, only the first one will be included in the results.
if type is a subclass of Component or GameObject the full SelectionMode is supported.
if type does not subclass from Component or GameObject (eg. Mesh or ScriptableObject) only SelectionMode.ExcludePrefab and SelectionMode.Editable are supported.

class ToggleActive extends ScriptableObject {
    @MenuItem ("Example/Toggle Active of Selected %i")
    static function DoToggle() {
        var activeGOs: Object[] =
            Selection.GetFiltered(
                GameObject,
                SelectionMode.Editable | SelectionMode.TopLevel);

for (var obj in activeGOs) var activeGO = obj as GameObject; activeGO.SetActive(!activeGO.activeSelf); } }