I’m trying to write a simple window replacement for default inspector for the time being until whole inspector is using UIElements. I have following code:
var root = this.GetRootVisualContainer();
root.Clear();
if (Selection.activeGameObject != null)
{
var allComponents = Selection.activeGameObject.GetComponents<Component>();
for (int i = 0; i < allComponents.Length; i++)
{
Label lbl = new Label(allComponents[i].GetType().Name);
lbl.style.fontStyleAndWeight = FontStyle.Bold;
lbl.style.borderLeftWidth = 2;
lbl.style.borderRightWidth = 2;
lbl.style.borderTopWidth = 2;
lbl.style.borderBottomWidth = 2;
lbl.style.borderColor = Color.black;
root.Add(lbl);
InspectorElement inspector = new InspectorElement(allComponents[i]);
root.Add(inspector);
}
}
The layout of controls generated by this code looks a follows:
As outlined is the inspector element. We can clearly see that is has flex-grow set to 1. If I set this parameter to 0 via code or using the Debuger I end up with this:
This is incorrect, as according to the flex box specification, container should take at least the height of it’s children.
Is this know issue? (Unity 2018.3.9f)