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

Question Multiple CustomEditor on the same class

Discussion in 'Editor & General Support' started by xXApOXx, Dec 13, 2022.

  1. xXApOXx

    xXApOXx

    Joined:
    Feb 9, 2015
    Posts:
    76
    Hi,

    I made a custom editor and I set the parameter "editorForChildClasses" to true.
    But for one of the class child, I wish to have a completely different custom editor.
    Except Unity still loads the parent custom editor.

    Is there a way to force Unity to load the custom editor of my choice? I wish to have the liberty to choose depending on the context.

    Thx!
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,940
    You could make a derived type of your custom editor for your child type and override it's OnGUI method. Then you can call
    base.OnGUI
    where needed, or your alternate inspector code.
     
  3. xXApOXx

    xXApOXx

    Joined:
    Feb 9, 2015
    Posts:
    76
    Thx for the tip.

    Anoter thing I found is that Unity always load the cutsom editor of the class prior to the parent one AFTER rebooting Unity.