Search Unity

EditorGuilayout.Popup equivalent

Discussion in 'UI Toolkit' started by WizByteGames, May 31, 2019.

  1. WizByteGames

    WizByteGames

    Joined:
    Mar 28, 2013
    Posts:
    70
    EditorGUILayout.Popup doesn't seem to have an UI Elements equivalent. Or am I missing something? Or do I need to create it with a set of visual elements?
     
  2. WizByteGames

    WizByteGames

    Joined:
    Mar 28, 2013
    Posts:
    70
    I just found the PopupField<T0> But I'm a bit confused as to how to add items to the list.
     
  3. WizByteGames

    WizByteGames

    Joined:
    Mar 28, 2013
    Posts:
    70
    Nevermind I figured it out. Didn't know that there were multiple overloads I could choose from to populate the list of items I wanted to add.
     
  4. WizByteGames

    WizByteGames

    Joined:
    Mar 28, 2013
    Posts:
    70
    Ok I have one more issue that is really bugging me about the popup field. It seem that when I register an event change callback nothing happens. So I tried registering an event value change callback, but I get an error saying " 'PopupField<string>' does not contain a definition for 'RegisterValueChangedCallback' "

    So how do I tell my editor if a value in a popupfield has been changed.
     
  5. WizByteGames

    WizByteGames

    Joined:
    Mar 28, 2013
    Posts:
    70
    OK So I got it working. I didn't know that the Popupfeild<T> had to match the type that ChangeEvent<T> was calling in order for it to work. Or at least that is how I got it to work.