Is there a way I can shorten the width of the label on this UIElement IntegerField through code, or would I need to use USS? Also, I’d like to increase the size of the input field to a fixed width.
Yes. That would probably be something like this:
var integerField = new UnityEditor.UIElements.IntegerField();
// increase the size of the input field to a fixed width:
int fixedWidth = 100;
integerField.style.maxWidth = fixedWidth;
integerField.style.minWidth = fixedWidth;
// shorten the width of the label:
foreach( var ve in integerField.Children() )
if( ve is UnityEngine.UIElements.Label )
ve.style.maxWidth = 30;