コード例 #1
0
    public static void CreatNewModule()
    {
        Rect rect = new Rect(0, 0, 350f, 100f);

        view = EditorWindow.GetWindowWithRect(typeof(ModuleBuildView), rect, true, "CreatViewItem") as ModuleBuildView;
        view.Show();
        if (Selection.gameObjects.Length == 1)
        {
            view.moduleNameTxt = Selection.gameObjects[0].name;
        }
    }
コード例 #2
0
    public static void RefreshUIFile()
    {
        if (Selection.gameObjects.Length == 0)
        {
            return;
        }
        if (Selection.gameObjects[0].transform.parent == null || Selection.gameObjects[0].transform.parent.GetComponent <Canvas>() == null)
        {
            EditorUtility.DisplayDialog("Update Fail", "请选择Panel!", "OK");
            return;
        }

        ModuleBuildView.RefreshUI(Selection.gameObjects[0].name, Selection.gameObjects[0], true);
        PrefabUtility.ApplyPrefabInstance(Selection.objects[0] as GameObject, InteractionMode.AutomatedAction);

        EditorUtility.DisplayDialog("完成", "代码刷新完成。", "OK");
        EditorUtility.DisplayDialog("完成", "预制体同步完成。", "OK");
        AssetDatabase.Refresh();
    }