Search Unity

UIElements: coming soon?

Discussion in 'UI Toolkit' started by Devi-User, Oct 2, 2018.

  1. Devi-User

    Devi-User

    Joined:
    Apr 30, 2016
    Posts:
    61
    I see UIElements in the list of experimental features and am very intrigued.
    I want to rewrite the currently created asset using UIElements, as UIElements allows to solve some problems that cannot be solved in any other way.
    But I do not see any documentation at the moment, except for a brief reference in the manual. Github repository is unavailable too.
    I intend to spend about half a year on asset development, and I would like to understand how likely it is that UIElements can become ready for this period.
    And what will happen to the old OnGUI with time?
     
  2. Devi-User

    Devi-User

    Joined:
    Apr 30, 2016
    Posts:
    61
    I would also like more information about the future direction of change: what will change, what will remain. Will it be the same object model with manipulators and styles, will the basic interfaces change?
    Such information would greatly help me, I could pay more attention first of all to what will change with time to a lesser extent.
     
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,521
    Right now they have the example projects and I believe 2018.3 should include the current API in experimental which for the most part works fine for building editor UI systems. There are like 13 examples in the git repo. They emptied the main repo and moved started branches for each version. This is pointed out in the main repo.

    https://github.com/Unity-Technologies/UIElementsExamples/tree/2018.3.0a7

    Documentation is limited, outside of the included examples in the repo so for the most part you just need to rummage through the examples and API to find what you need. It's not totally clear what best practices and such are and what you should be focusing on just yet but you can still get a lot done if you take the time to learn whats there - which IMO is worth it since it's quite a leap forward from IMGUI.
     
  4. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    To add to what LaneFox said, UIElements is planned to go out of experimental in the next Unity release (19.1). Documentation and proper examples should come at that time. Until then, there are the current (unsupported) GitHub examples:
    https://github.com/Unity-Technologies/UIElementsExamples/tree/2018.3.0a7
    and this quick intro video for UIElements:


    More info, along with a more involved demo, will come at Unite LA 2018.
     
    afshinity, Lurking-Ninja and LaneFox like this.
  5. Devi-User

    Devi-User

    Joined:
    Apr 30, 2016
    Posts:
    61
    Thank you. I didn’t see where the developers indicated that examples can be found in a particular branch, and rarely pay attention to this function inside github, so what you indicated to it really helped me.
    This information was enough to start development.

    I hope that the new versions will retain the ability to override filters in classes similar to ContentDragger, where filters are defined in the constructor.

    I also experience difficulties in order to remove unnecessary RegisterCallbacks from the constructor in GraphView, since they use private methods.
     
    Last edited: Oct 9, 2018
  6. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    What do you mean by filters?

    Which callbacks were giving you trouble?
     
  7. Devi-User

    Devi-User

    Joined:
    Apr 30, 2016
    Posts:
    61
    ManipulatorActivationFilter
    There are many places where they are explicitly indicated, but fortunately, the list of activators can be cleared.

    In GraphView it:
    this.RegisterCallback<ContextualMenuPopulateEvent>(new EventCallback<ContextualMenuPopulateEvent>(this.OnContextualMenu), Capture.NoCapture);
    I absolutely do not like the way the context menu is now done, when it works while moving. I tried to achieve a behavior in which the movement of the right button will move the graph, and pressing the right button brings up the context menu. In addition, I do not like the standard context menu windows, they become inconvenient for large menus and I replaced them with my own with the search field.

    Now this callback refers to a private method that calls a virtual method, which, fortunately, I can override as empty. However, this does not give any guarantee that the private method will not be in future implementations contain anything more. This is the reason why I would like to be able to unsubscribe from it altogether.
     
  8. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    Understood and noted. We're unlikely to make any major changes to GraphView short term so if things work for you now with your current workarounds, they should continue to work.
     
  9. Devi-User

    Devi-User

    Joined:
    Apr 30, 2016
    Posts:
    61
    in 2018.3 pressing the right button blocks part of the calls. This has become a problem in reassigning it. I can only move again after clicking the left mouse button.

    Code (CSharp):
    1. var graph = new CustomGraphView();
    2. var contentDragger = new ContentDragger
    3. {
    4.     panSpeed = new Vector2(1, 1),
    5. };
    6. contentDragger.activators.Clear();
    7. contentDragger.activators.Add(new ManipulatorActivationFilter
    8. {
    9.     button = MouseButton.RightMouse,
    10.     clickCount = 1
    11. });
    12. graph.AddManipulator(contentDragger);
     

    Attached Files:

  10. benoitd_unity

    benoitd_unity

    Unity Technologies

    Joined:
    Jan 2, 2018
    Posts:
    331
    FYI, we now have a dedicated sub-forums where you can use for all your questions and feedback related to UI Systems Previews.

    Cheers,