Search Unity

Unity 2018.3 and ExecuteMenuItem

Discussion in 'Editor & General Support' started by Siberdt, Dec 13, 2018.

  1. Siberdt

    Siberdt

    Joined:
    Dec 15, 2009
    Posts:
    59
    Hello, how can I open the "new style" of Player settings tab by code?
    The command:

    EditorApplication.ExecuteMenuItem("Edit/Project Settings/Player");

    now generates this error:

    ExecuteMenuItem failed because there is no menu named 'Edit/Project Settings/Player'
    UnityEditor.EditorApplication:ExecuteMenuItem(String)

    ... and I can't find the right solution to fix it :(
     
  2. Siberdt

    Siberdt

    Joined:
    Dec 15, 2009
    Posts:
    59
    Update... ok, I can open Project Settings by:

    EditorApplication.ExecuteMenuItem("Edit/Project Settings...");


    ...still can't open Player tab
     
  3. beautyfullcastle

    beautyfullcastle

    Joined:
    Jan 22, 2015
    Posts:
    4
    Try this one.

    Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
     
  4. GabrielFleury

    GabrielFleury

    Joined:
    Jun 15, 2018
    Posts:
    2
    [QUOTE = "beautyfullcastle, postagem: 4130005, membro: 756332"] Tente este.

    Selection.activeObject = Não suportado.GetSerializedAssetInterfaceSingleton ("PlayerSettings"); [/ QUOTE]

    Working for me...

    Thanks
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,624
    While this does work, there seem to be new issues when opening the Player Settings for some platforms in the inspector. For example, a portable console target platform sits there throwing exceptions when Player Settings is opened in the inspector this way. It doesn't do this when opened the new way through the Project Settings panel. This solution by Chris-KillerSnails is better: It opens the new plane and it doesn't use a class called "Unsupported."

    Code (csharp):
    1. SettingsService.OpenProjectSettings("Project/Player");
     
    Last edited: Apr 12, 2019
    Grumpy-Dot and freakrho like this.