Code (csharp): VisualElement node = new VisualElement { name = selectorName }; To reduce ambiguity can the name property become selector or selectorName? This is the only instance I can think of in Unity during normal workflow where "name" is not the name of the element or component. When first being introduced to UIElements and not knowing anything about traditional web development or css this is a bit confusing. It is also a little odd since it is done through a constructor, where "name" would be even more appropriate for naming the element rather than looking up a selector name reference for which to apply properties to the new element.
Hello sir, I have been using Unity for a while so I am quite familiar with the current Editor GUI. But I really want to start using this new UIElements but I have no idea how to start, I could find no examples on the docs and the github page that once housed some examples has been removed. Would you be kind enough to give me an example or point me to a location where I can find something to help me begin? Thank you so much!
Main repo was stripped and moved into version branches. Since this is off-topic you should make a new post about it. https://github.com/Unity-Technologies/UIElementsExamples/tree/2018.3.0a7
UIElements is still Experimental as of 18.3. More complete docs and examples will be released alongside UIElements when it comes out of Experimental. The current plan is to do this for the 19.1 Unity release. The UIElements API is still expected to change. But back on the topic of this thread, "name" is not really equivalent to "selector". A selector can be based on the name, but it can also be based on the C# type of the element or the style classes it has on it. Name is equivalent to the "id" on the web. It's meant to be used much like GameObject names to more easily find the element, both for styling (selectors) and within C# using uQuery to register events on it.
FYI, we now have a dedicated sub-forums where you can use for all your questions and feedback related to UI Systems Previews. Cheers,