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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Editor: Create buttons to navigate between parameters

Discussion in 'Scripting' started by diasrodrigo, Jul 5, 2018.

  1. diasrodrigo

    diasrodrigo

    Joined:
    Jul 4, 2017
    Posts:
    420
    Hello

    I would like to create buttons to set different parameters categories in the same script. I would like to do something like this

    upload_2018-7-5_8-0-4.png

    If I select Scene option, Inspector wil show parameters related to this, if I selecte Global Maps, parameters of global map, but all of this in the same script. I would like to know Unity Editor function that allow me create it. I know it's not so simple as a function, but the idea to start work with it.

    Thank you!
     
  2. BlackMantis

    BlackMantis

    Joined:
    Feb 7, 2010
    Posts:
    1,475
    Hello, you could use a bool to show / hide editor GUI.
    Code (CSharp):
    1.  
    2. string page = "";
    3.  
    4. void OnGUI() {
    5.     if( GUILayout.Button( "Home", GUILayout.Width( 100 ) ) ) { page = "HomePage"; }
    6.     if( page == "HomePage" ) { HomePage(); }
    7. }
    8.  
    9. void HomePage() {
    10.     // params
    11. }
    12.  
     
    diasrodrigo likes this.
  3. diasrodrigo

    diasrodrigo

    Joined:
    Jul 4, 2017
    Posts:
    420
    I'll try this logic. Thanks