So for the past couple of days I've been trying out the new Unity UI Builder and I came across the following issue: Whenever you simply add a Vector3 field to the uxml and run the game the Vector3 field is scaled incorrectly. In the editor it looks like any Vector3 field would, just like the Unity Editor itself has. Below is an example image and the uxml.
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements">
<ui:VisualElement style="flex-grow: 1; position: absolute; height: 100%; width: 100%; justify-content: center; align-items: flex-start;">
<ui:VisualElement>
<uie:Vector3Field label="Vec3 Field" />
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>
I have messed around with every field presented to me in the builder without any success. I could do away with the Vector3 field and create my own but that would take more time as I'd need to dive deeper into the source code. I hope someone can help me out. If the issue does seem to be common I'll report it to the Unity devs.
Thanks in advance!
xmlns:uie="UnityEditor.UIElements"
will likely throw you an exception looking for thisUnityEditor.UIElements.Vector3Field
class. – Andrew ŁukasikUnityEditor.*
classes are for editor only, so we need to useUnityEngine.*
ones or create our own container types for runtime use (it's not that hard to display vector3 as it's just 3 xFloatField
) – Andrew Łukasik