Search Unity

Override an IMGUI Editor with UI Toolkit

Discussion in 'UI Toolkit' started by Araj, Jun 8, 2020.

  1. Araj

    Araj

    Joined:
    Jan 3, 2013
    Posts:
    27
    Hi!

    I'm trying to create a new Editor for the AnimationClip class, but I've seen that Unity has already one using IMGUI. The thing is that this quick test:
    Code (CSharp):
    1.     [CustomEditor(typeof(AnimationClip), true, isFallback = true)]
    2.     public class AnimationClipEditor : Editor
    3.     {
    4.         public override VisualElement CreateInspectorGUI()
    5.         {
    6.             return new Label("This is a custom editor for AnimationClip");
    7.         }
    8.     }
    Doesn't work, as Unity is using the default AnimationClipEditor instead of the one that I created.

    Is there a way to force Unity to use my editor instead of the default one?
    Any ETA on when the Unity's AnimationClipEditor will be changed to UI Toolkit?

    Thank you!
     
  2. sebastiend-unity

    sebastiend-unity

    Unity Technologies

    Joined:
    Nov 9, 2015
    Posts:
    115
    Hi Araj, from my understanding isFallback should be set to false, otherwise your custom editor will only be used if all non-fallback editors don't match...
     
unityunity