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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to draw an Editor Window inside another Editor Window ?

Discussion in 'Editor & General Support' started by thrmotta, Oct 8, 2015.

  1. thrmotta

    thrmotta

    Joined:
    May 27, 2014
    Posts:
    32
    Recently I got an asset from the Asset Store which creates an EditorWindow, called Capture, and lets the user manually configurate its preference, which works just fine.

    In my project I use another EditorWindow, called Multimedia, to manually configurate another set of preferences, which also works just fine.

    Since both of them "do the same thing", Id like to keep it to a single EditorWindow, drawing first the Multimedia EditorWindow and then, right below it, draw the Capture Editor Window.

    I have managed to do this by opening the Capture Editor Window first and then calling Capture.OnGUI inside Multimedia.OnGUI, which its kind of a lousy solution since I dont need both windows opened.

    So how can I draw both Capture and Multimedia in the same EditorWindow without having both of them opened at the same time ?

    Thanks!
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    You can expose one window's logic as a public method and then call that from the other window's OnGUI callback
     
  3. thrmotta

    thrmotta

    Joined:
    May 27, 2014
    Posts:
    32
    In that case wouldnt I need to instantiate the window so it can hold the modified values? Or would I need to make the whole class static in order to save those values?