Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Open "Build Settings" window via Editor script?

Discussion in 'Scripting' started by CrowbarSka, Apr 29, 2020.

  1. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    Hello!

    Is it possible to pop open the Build Settings editor window via editor script?

    I have a button in my own custom editor window, and I want it to open the Build Settings window when clicked.

    Thanks in advance!
     
  2. SplenShepard

    SplenShepard

    Joined:
    Aug 24, 2019
    Posts:
    16
    Bump. Curious about this.
     
    CrowbarSka likes this.
  3. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    I did actually find a solution at some point, but forgot to update this thread. Sorry!

    Code (CSharp):
    1. using UnityEditor;
    2.  
    3. // Open BuildSettings as a dockable window
    4. EditorWindow.GetWindow(System.Type.GetType("UnityEditor.BuildPlayerWindow,UnityEditor"));
    5.  
    6. // Or, in older versions of Unity you can open it as the normal (non-dockable) floating window. Newer versions ALWAYS use a dockable window. I'm not sure when that changed.
    7. EditorApplication.ExecuteMenuItem("File/Build Settings...");
    Hope that helps. I personally just use the first solution listed above since I prefer dockable windows.
     
    NMJ_GD, Rand_D, DevDunk and 1 other person like this.