public void AddScrollSection(UIScrollSection section) { section.transform.parent = transform; section.transform.localPosition = Vector3.zero; section.transform.localScale = Vector3.one; listScrollSections.Add(section); Reposition(); }
private void CreateItems() { // Title. { GameObject go = new GameObject(); go.name = "Title"; UIScrollSection section = go.AddComponent <UIScrollSection>(); section.contentWidth = 420f; section.contentHeight = 60f; section.arrangement = UIScrollSection.Arrangement.Vertical; go.AddComponent <UIScrollBlinker>(); UIScrollContent content = new UIScrollContent(); content.id = "Items"; content.prefab = prefabTitle; content.onInitContent = InitalizeTitle; section.AddScrollContent(content); section.CalculateBounds(); scrollBuilder.AddScrollSection(section); } // Items. { GameObject go = new GameObject(); go.name = "Items"; UIScrollSection section = go.AddComponent <UIScrollSection>(); section.arrangement = UIScrollSection.Arrangement.Vertical; section.contentWidth = 420f; section.contentHeight = 60f; section.arrangement = UIScrollSection.Arrangement.Vertical; go.AddComponent <UIScrollBlinker>(); foreach (string item in items) { UIScrollContent content = new UIScrollContent(); content.id = item; content.prefab = prefabItem; content.onInitContent = InitalizeItem; section.AddScrollContent(content); } section.CalculateBounds(); scrollBuilder.AddScrollSection(section); } }