// Creates the sub menu group, and also calls setup on that gameobjects script to create the buttons within the group. private void AddSubMenuGroup() { this.SubMenugrp = this.SubMenuGroupPool.GetObject(); this.SubMenugrp.transform.SetParent(this.transform); this.SubMenuGroupScript = this.SubMenugrp.GetComponent <SubMenuGroupPref> (); SubMenuGroupScript.Setup(this.SubMenuList, this.SubButtonPool); }
// Setup for sub button prefab. Takes a sub menu object that contains the information and the script of the parent sub menu group. public void Setup(SubMenu sbMenu, SubMenuGroupPref parent) { this.TextField.text = sbMenu.Title; this._parentGroup = parent; this._pageswapper = GameObject.FindWithTag("Pageswapper").GetComponent <Pageswapper>(); this._Button = transform.GetComponent <Button> (); this._Button.onClick.RemoveAllListeners(); if (sbMenu.Target != null) { sbMenu.setButton(this._Button); } }