arimger/Unity-Editor-Toolbox

[HorizontalGroup] and [ReorderableList] conflict

jinsediaoying opened this issue · 11 comments

[BeginHorizontal]
[ReorderableList]
public ParticleSystem[] particles;

[ReorderableList]
[EndHorizontal]
public float[] baseDelay;

DP_XAHSSWG4Z_QS U{TTT)R

Thanks, I will fix it.

Fix available on the master/upm branch. Version 0.8.11.

ro

image
It seems like that the horizontal space calculation is based on the list items count.

GTO}N2X$QA}DC7YA{PT{A
And non ReorderableList version list drawers with HorizontalGroup is still buggy.

I just pushed a fix to the development branch, but using HorizontalGroups may be a little bit tricky. You have to use fieldToWidthRatio and labelToWidthRatio to keep elements nice looking, if values are equal to 0 (default situation) field may look strange but the horizontal group should work properly.

    [BeginHorizontal(fieldToWidthRatio: 0.2f, labelToWidthRatio: 0.2f)]
    public int[] ints1;
    [EndHorizontal]
    public int[] ints2;

Unfortunately, groups don't know how many elements are inside, that's why you have to adjust ratios.

Additionally, remember about decorators - you are able to add [SpaceArea] between elements in the horizontal group to create spacings.

One small update - I added [Begin/EndHorizontalGroup] to mirror the functionality of the [Begin/EndGroup] but for horizontal controls.
horizontal

public class Test : MonoBehaviour
{
	[BeginHorizontalGroup]
	public int x;

	[EndHorizontalGroup]
	public int y;
}

67ZDRC98 @%)KNEGZQ}_D

Looks not working?

The fieldToWidthRatio/labelToWidthRatio thing is confusing, it that means I have to calculate the width based on the item count per row manually?

Are you sure you have [Begin/EndHorizontalGroup] available in the settings file (Edit/Project Settings.../Editor Toolbox/Inspector)?
image

About fieldToWidthRatio/labelToWidthRatio - it means you can (it's not necessary) adjust the width of labels and fields within horizontal groups.
ratio
In this example labelToWidthRatio = 0.1f, it means that every label will try to fill space equal to width * 0.1f.

Sorry, I forget to change the ProjectSetting, It now looks correct.

Do you have any other troubles using horizontal groups?