編輯器拓展 => 自定義快捷鍵

控制所選層級面板物體的激活狀態


public class GameObjectControl
{
    //控制當前選擇對象的顯示 alt + f
    [MenuItem("Toolkit/GameObject/Active GameObject  &f")]
    public static void ActiveGameObject()
    {
        GameObject[] objs = Selection.gameObjects;
        if (objs.Length == 0) return;
        bool isActive = !objs[0].activeSelf;
        for (int i = 0; i < objs.Length; i++)
        {
            objs[i].SetActive(isActive);
        }
    }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章