Search Unity

Feature Request Simple line drawing on to of the UI

Discussion in 'UI Toolkit' started by pKallv, Dec 28, 2018.

  1. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,191
    Is this something that is considered, if not: It is needed.
     
  2. MartinIsla

    MartinIsla

    Joined:
    Sep 18, 2013
    Posts:
    104
    For now, I use an IMGUI container and the good ol' Handles.DrawLine, Handles.DrawBezier, Handles.DrawAALineor whatever you want.
    Not perfect (I'd love to never see IMGUI again), but it works!
     
    pKallv likes this.
  3. JoshuaMcKenzie

    JoshuaMcKenzie

    Joined:
    Jun 20, 2015
    Posts:
    916
    You can also look at the code for the EdgeControl in the GraphView repo for an example of how Edges (e.g. lines) are rendered on a Graphview, without relying on IMGUI.
     
  4. jonathanma_unity

    jonathanma_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    229
    Hi, currently the only way to do custom rendering in UIElements is by inheriting from ImmediateModeElement and overriding the ImmediateRepaint function.

    From there you have access to Handles, Graphics and so on.