Version: 2017.1
public static Transform[] GetTransforms (SelectionMode mode);

Parámetros

mode Opciones para re-definir la selección.

Descripción

Permite un control más fino para el tipo de selección utilizando el bitmask SelectionMode.

class CreateParentForTransforms extends ScriptableObject {
    @MenuItem ("Example/Create Parent For Selection _p")
    static function MenuInsertParent() {
        var selection: Transform[] =  Selection.GetTransforms(
        SelectionMode.TopLevel | SelectionMode.Editable);
        var newParent: GameObject = new GameObject("Parent");

for (var t in selection) t.parent = newParent.transform; } // Disable the menu if there is nothing selected @MenuItem ("Example/Create Parent For Selection _p", true) static function ValidateSelection() { return Selection.activeGameObject != null; } }