Hey guys,
I spent quite some time trying to find out myself and searching the net, without any success, so I really need your help…
Under a UI panel with a HorizontalLayoutGroup I have some child components, of which I need to control the width programmatically in certain situations.
To achieve this, I have a LayoutElement attached to the children and set the PreferredWidth by script to the required value, which is working fine.
Unfortunately, there are also situations where I need to remove the preferred width, so that the element width is again under full control of the parent’s LayoutGroup.
How can I achieve this? I couldn’t find any method, nor does the float property accept null as value.
Any help is appreciated!