Unity-Technologies / UIElementsExamples

Unity project containing examples to use UIElements in the Editor
435 stars 67 forks source link

UIElements in Unity Player rather than in Editor #21

Open yuriy-universal-ivanov opened 6 years ago

yuriy-universal-ivanov commented 6 years ago

Dear Unity team,

I really love the direction you're taking with that new UIElements experimental functionality for the editor. I noticed that UIElements.VisualElement belongs to UnityEngine.Experimental namespace (Unity 2018.2.2f1), not UnityEditor.Experimental. So I tried creating an empty VisualElement in my sample script Start method and then building and deploying it to an Android device, and it seems to work: the object is created, no exception is thrown - looks promising so far.

But now I'm kinda stuck: one has to assign a VisualElement to a root in order to make it render and act. It's simple in Unity Editor: there is that GetRootVisualContainer for that purpose, but is there a way to get a root somehow in the Unity Player as well (f.e. using a Canvas object)? Or the root container functionality is not available in the Unity Player at the moment? If so, are there any plans to migrate that functionality to the player too?

Looking forward to hearing from you, Yuriy

moelang commented 6 years ago

They were planned for it, but only for Editor at the moment. https://forum.unity.com/threads/uielements-can-they-be-used-for-in-game-ui.484253/