Search Unity

Feedback Add CreateDefaultInspector() to Editor class for custom inspector

Discussion in 'UI Toolkit' started by Kichang-Kim, Aug 8, 2019.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,011
    Hi. As a title said, current Editor.CreateDefaultInspector() overrides entire Inspector UI so if you want to add simple additional button to inspector, you should create all of default insepctor element yourself or using legacy IMGUI container (https://forum.unity.com/threads/new...o-draw-default-inspector.674269/#post-4626415).

    I thnk UIElements version of default inspector element makes many developers be happy.

    Thanks.
     
  2. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    780
    Hello,

    Indeed this is something we have in mind for the future. Thanks for your feedback.
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    A really nice utility would be to be able to have a call that would spit out the uxml (and possibly uss) that would define the default editor.

    Often you want a custom editor to be 95% like the default one, but with some changes here and there. If you could automatically generate the default uxml so we could copy that and edit it, that'd be great.

    We'd of course have to manually update it once the target script changes, but that's fine - the alternative is to write the entire editor from scratch, in which case that'd still be the case.

    Alternatively, once you switch default editors to be uxml-based, we could generate the root visual element, and then target the things we want to edit with UQuery. That would require the elements to have some identifier we could use to hook into.