using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class NewRouteOverviewController: PFUIPanel { // Start is called before the first frame update Transform tmpGroup; Transform tmpItem; void Start() { tmpGroup = Resources.Load("UI/Prefab/NewRoute/RouteGroup"); tmpItem = Resources.Load("UI/Prefab/NewRoute/RouteItem"); var rect = transform.Find("Container/Right/Scroll View/Viewport/Content") .GetComponent(); for (int i = 0; i < 10; i++) { var group = Instantiate(tmpGroup); for (int j = 0; j < 10; j++) { var item = Instantiate(tmpItem); item.SetParent(group.Find("Content")); } group.SetParent(rect); group.localScale = Vector3.one; } LayoutRebuilder.ForceRebuildLayoutImmediate(rect); } // Update is called once per frame void Update() { } }