Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Issues with Custom-Editor inside Editor-Window

Discussion in 'Scripting' started by Noblauch, Jul 8, 2020.

  1. Noblauch

    Noblauch

    Joined:
    May 23, 2017
    Posts:
    276
    Hi, I have a problem in my custom editor window :/

    I created a custom logger, settings are defined via a scriptable object that uses a custom editor. Everything works perfectly fine inside the inspector, I can select and edit everything. But when I display the scriptable object inside my editor window (for convenience) one functions of the ReorderableList I use don't work anymore: selecting entries.
    ReorderableListEditorWindow.png
    Red is the editor window. Everything works fine except I can't select the entries as seen in the inspector (green) below.

    The code used to display the scriptable object inside the editor window is the following:

    var editor = Editor.CreateEditor(LogEditor.PrivateLogSettings);
    editor.OnInspectorGUI();
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,342
    I don't think you want to recreate the editor every frame, as that'll discard any data tied to the editor - like selected stuff. You probably want to create that editor when you create the editor window, store it in a field, and use it later.
     
    Noblauch likes this.
  3. Noblauch

    Noblauch

    Joined:
    May 23, 2017
    Posts:
    276
    This is why I love this Forum. So many helpful people! ;)

    Thank you Baste!