Search Unity

[Editor] Making animated gizmos

Discussion in 'Immediate Mode GUI (IMGUI)' started by The-Spaniard, Feb 20, 2015.

  1. The-Spaniard

    The-Spaniard

    Joined:
    Jan 7, 2012
    Posts:
    149
    Hi everyone!

    In my work on a bezier path editor, I've been trying to create editor nodes that "pulse" or animate in some way to show that they are active/selected. It's not totally essential, but I was wondering if anyone has found a way to do it?

    What I have for now is the size parameter of the gizmo being put through Mathf.Sin(), which works great if the scene window is being moved around, but because OnGizmo only runs when the scene view is changing, the pulsing doesn't work if the user is not interacting (somewhat defeating the purpose of making the gizmos more noticable...). So ideally I need to find a way for the editor script drawing the gizmos to update at the editor's refresh rate.

    Any ideas?
     
  2. karl_

    karl_

    Joined:
    Mar 4, 2010
    Posts:
    464
    Just register with the `EditorApplication.update` delegate, then you get a callback every frame.
     
  3. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481