public void CreateNewPage(int pageNum) { GameObject pageLayout = Instantiate(pageLayoutPrefab); pageList.Add(pageLayout); pageLayout.transform.SetParent(pageContainer.transform); pageLayout.transform.localScale = Vector3.one; Vector3 position3D = new Vector3(launcherModel.screenWidth, 0f, 0f); if (pageNum == 0) { position3D = new Vector3(0f, 0f, 0f); } PageLayout control = pageLayout.GetComponent <PageLayout> (); control.pageNumber = pageNum; control.setUITransform(position3D); }