void CreateSectionButton() { GameObject inst = Instantiate(sectionButtonPrefab); inst.transform.parent = this.transform; SectionButton sb = inst.GetComponent <SectionButton>(); sb.SetSection(sections.Count - 1); sectionButtons.Add(sb); SetButtonPositions(); }
public void CreateSectionButtons() { for (int i = 0; i < sections.Count; i++) { GameObject inst = Instantiate(sectionButtonPrefab); inst.transform.parent = this.transform; float xPos = (maxSections - sections.Count) / 2 + i; inst.transform.localPosition = new Vector3(xPos, 0, 0); SectionButton sb = inst.GetComponent <SectionButton>(); sb.SetSection(i); sectionButtons.Add(sb); } }