I was hoping for a replacement for EditorGUILayout.LabelField(“My Text”, “Some longer text”). Is there any editor-specific label in UI Toolkit which supports two strings and does the typical inspector layout with two columns? I’m specifically looking for static text, not the UI Toolkit TextField which takes user input.
Hey! Nothing built-in at this point to do this, but you can achieve this by creating a VisualElement (with flex-direction:row) with two Label children.
Thanks, yea that’s something I can use, but I’m mostly concerned with getting the sizes right. In IMGUI, the EditorGUI.labelWidth defined how much space was reserved for labels vs content on the right side. I assume this value is still defined somewhere in UI Toolkit, maybe via some unity style I can use?
Hello! As @martinpa_unity mentioned we don’t have a LabelField control right now, but we would definitely add it in the future since we want to reach parity with IMGUI.
About aligning custom fields, we are currently working on a few improvements so you can opt-in for the label alignment behavior. Right now, there is no workaround for this other than manually setting your width and min-width according to your inspector element size and nesting level in foldouts and lists.