Hi all,
I am trying to tidy up the UI for some of my classes in Unity’s inspector and am getting quite frustrated by the large gap which gets left between fields and their labels. For example I have class with a bunch of fields like this:
[SerializeField, Inspectable, InspectorTextArea, InspectorLabel("Speech")]
private string Text = string.Empty;
[SerializeField, Inspectable, InspectorLabel("Pose")]
private PoseData PoseData = new PoseData();
[SerializeField, Inspectable, InspectorLabel("Position")]
private CharacterDirector.Location Location = CharacterDirector.Location.NoChange;
[SerializeField, Inspectable, InspectorLabel("Mirrored")]
private bool Mirrorred = false;
Where Location is an enum and PoseData is a class, for which I have written a PropertyDrawer. This produces UI in the inspector which looks like this:
The only way I have found to get rid of this gap is to set the InspectorLabel to an empty string. Like so :
[SerializeField, Inspectable, InspectorTextArea, InspectorLabel("")]
private string Text = string.Empty;
[SerializeField, Inspectable, InspectorLabel("")]
private PoseData PoseData = new PoseData();
[SerializeField, Inspectable, InspectorLabel("")]
private CharacterDirector.Location Location = CharacterDirector.Location.NoChange;
[SerializeField, Inspectable, InspectorLabel("")]
private bool Mirrorred = false;
But then I obviously get no labels, which isn’t ideal and, even allowing that, it only works for the one custom type, PoseData, the rest retain the gap :
Can anyone suggest a way to have the property fill all the available space after the label?
Thanks in advance!