Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

clickable arrow/transition like in Mecanim/AnimatorController window

Discussion in 'Immediate Mode GUI (IMGUI)' started by Breyer, Apr 22, 2014.

  1. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    As i said i need arrow which i can select and can be mulitple transition (three arrow) like in AnimatorController window. Its use texture/guistyle and GUI.toggle with rotated rect? if yes they are exposed in unity gui editor API ?(e.g. new GUIStyle("name_for_arrow") ) or use GL class or another solution? Could you help me with this?

    i made small research with inspector for editor guistyles for me but no luck ;/

    thanks in advance
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    To my knowledge there's nothing in the editor API, so you'll have to use GL. See this link for a tutorial on drawing triangles.

    To tell if the user has clicked on the arrow line, check if Event.current.mousePosition is on the line defined by the endpoints of the arrow +/- a certain tolerance, maybe 4-6 pixels or so.
     
  3. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    AnimatorController just uses the GL class. The arrow heads are just triangles and the edges seem to be drawn using (undocumented) Handles.DrawAAPolyLine.
     
    Demigiant likes this.
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    Drawing lines using Handles.DrawBezier works well enough for me. Having the lines clickable.... that might be another story. I don't really know how I'd do that.