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
  3. Dismiss Notice

Question How to inject custom UI elements into existing IMGUI editors?

Discussion in 'Immediate Mode GUI (IMGUI)' started by AxonGenesis, May 18, 2024.

  1. AxonGenesis


    Jun 24, 2016
    Is there a way I could inject or modify UI elements in built-in editors, such as the Transform component?

    Here's a mockup adding some button icons and a color overlay as an example:

    So far, the only way I have found is to create my own custom editors for each component type. This essentially replaces the built-in editor with my own version.

    Code (CSharp):
    2. [CustomEditor(typeof(Transform))]
    3. public class TransformOverride : Editor
    The problem with this approach is that it replaces built-in functionality and is too likely to cause problems or change the behavior from what the user expects. It would also be a lot of work to do this for every component type.

    Is there some other way I could draw over the inspector and use reflection to detect property fields? I'd want to do this for all components on the object and inject UI for any compatible fields.