Hello. I have a vertical layout group with a list of attached images. It works well, a list of objects is created, but the problem is that the spacing between these objects is set at about 200 on the y axis. I cannot change the distance between the objects, I tried settings the padding but that didn’t work either. Here is my code
Image img0 = GameObject.Find(“ImageSlider”).GetComponent();
GameObject UItextGO2 = new GameObject(“Image77”);
UItextGO2.transform.SetParent(img0.transform);
RectTransform trans = UItextGO2.AddComponent();
trans.anchoredPosition = new Vector2(0, 0);
Image img1 = UItextGO2.AddComponent();
img1.GetComponent().color = Color.black;
Color color1 = img1.color;
color1.a = 0.1f;
img1.color = Color.clear;
VerticalLayoutGroup glg = UItextGO2.AddComponent();
glg.padding.left = 2;
glg.padding.right = 2;
glg.padding.top = 2;
glg.padding.bottom = 2;
This code works very well, but the objects that I add to it have a set spacing that I cannot change, can anyone help thanks.