Search Unity

Examples of using UIElements for scene view

Discussion in 'UIElements' started by taylank, May 24, 2019.

  1. taylank

    taylank

    Joined:
    Nov 3, 2012
    Posts:
    104
    Hi,
    I'm just dipping my toes in the new UIElements framework, and I'm looking for examples on how to utilize it for things I would have previously done in OnSceneGUI(). All the examples I can find on UIElements seem to work within their own editor windows. Is drawing to scene view possible at all with UI Elements?
     
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    221
    It's possible but we don't have a solid API around it. You basically get a reference to the Scene window and from that you get a reference to its rootVisualElement (all EditorWindows have one). With the root element, you can now add any VisualElements you want. The catch is that you are in full control and have to do all the cleanup yourself. It's not as slick as OnSceneGUI(). Proper OnSceneGUI() equivalency will come later.
     
    Lahcene likes this.