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

パラメーター

modeSelection を絞り込むためのオプション

説明

SelectionMode ビットマスクを使用して Selection の種類を細かく制御できます

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; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961