Exemplo n.º 1
0
    static void Init()
    {
        BSGWindow myWindow = (BSGWindow)GetWindow(typeof(BSGWindow));

        myWindow.titleContent = new GUIContent("Build Scene Generator");
        bsgObject             = new GameObject("BSG");
        bsgObject.hideFlags   = HideFlags.HideInHierarchy;
        bsgObject.AddComponent <BSGButtonScript>();
        inspectorGUICode = bsgObject.GetComponent <BSGButtonScript>();
        customEditor     = Editor.CreateEditor(inspectorGUICode);
        inspectorGUICode.Populate();
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        BSGButtonScript myScript = (BSGButtonScript)target;

        serializedObject.Update();
        GUILayout.Box("Build Settings Generator");

        GUILayout.Label("Current scenes in Build", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("currentScenes"), true);

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("Current settings", EditorStyles.boldLabel);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Get scenes list", GUILayout.MaxWidth(175), GUILayout.Height(25)))
        {
            myScript.Populate();
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        EditorGUI.BeginChangeCheck();

        GUILayout.Space(10.0f);
        GUILayout.Label("Custom scenes in Build", EditorStyles.boldLabel);
        GUILayout.BeginHorizontal();
        GUILayout.Label("List size: ", GUILayout.Height(25));
        if (GUILayout.Button("-", EditorStyles.miniButtonLeft, GUILayout.MaxWidth(25), GUILayout.Height(25)))
        {
            myScript.DecreaseListSize();
        }
        if (GUILayout.Button("+", EditorStyles.miniButtonRight, GUILayout.MaxWidth(25), GUILayout.Height(25)))
        {
            myScript.IncreaseListSize();
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        EditorGUILayout.PropertyField(serializedObject.FindProperty("customScenes"), true);
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("Custom scenes in Build", EditorStyles.boldLabel, GUILayout.MaxWidth(175));
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Apply new settings", GUILayout.MaxWidth(175), GUILayout.Height(25)))
        {
            myScript.AddScene();
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.Label("Info Ouput");
        GUILayout.TextArea(myScript.Errors);
        if (GUILayout.Button("Clear", GUILayout.Width(50)))
        {
            myScript.Clear();
        }

        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
        }
    }