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 Editor Scripting - Drawing UI onto AnimationWindow's layout.

Discussion in 'Scripting' started by Crazycarpet, May 6, 2022.

  1. Crazycarpet

    Crazycarpet

    Joined:
    Dec 5, 2015
    Posts:
    47
    I'm wanting to add a button to the AnimationWindow that's built into the Unity editor however I'm having trouble figuring out how I can reliably draw UI ontop of this window and position it correctly.

    Could someone point me in the right direction in how I can go about drawing on EditorWindows that are built into Unity? If possible I'd like to be-able to use GUILayouts like you would in the OnGUI method of a custom implemented EditorWindow. Thanks in advance for any suggestions, insights, or advice.
     
  2. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    1,051
    There's no way to do this that's not inherently hacky and prone to breaking. The
    AnimationWindow
    class is sealed and cannot be extended and it doesn't provide an hooks for you to extend its GUI.

    I would just create a custom editor window that you can dock next to the animation window and/or add a keyboard shortcut to trigger your functionality.
     
    Crazycarpet and Bunny83 like this.
  3. Crazycarpet

    Crazycarpet

    Joined:
    Dec 5, 2015
    Posts:
    47
    Thanks, sort of figured this was the case.
    I went witu MenuItems and keyboard shortcuts instead.

    Would be kind of nice to have an OnGUI delegate to add UI elements at the right time even if existing ones were not modifyable.