static void GroupToLayoutH() { GameObject g = Selection.activeGameObject; if (g == null) { return; } RectTransform rect = CreateGroup(); if (rect != null) { HorizontalLayoutGroup layout = rect.gameObject.AddComponent <HorizontalLayoutGroup>(); layout.SetMargin(defaultSpacing); layout.SetChildControl(defaultSpacing); rect.AddContentSizeFitter(); } }