public void OpenShoesMenu() { if (colorPicker != null) { colorPicker.SetActive(false); } if (shoesMenu != null) { shoesMenu.SetActive(true); } CloseHairMenu(); CloseTopMenu(); CloseBottomsMenu(); float x = -33.5f; float y = 160f; ButtonGroup buttons = shoesMenu.GetComponent <ButtonGroup>(); int count = 0; if (gender == "Female") { count = ItemInformation.GetFemaleShoesCount(); } else { count = ItemInformation.GetMaleShoesCount(); } for (int i = 0; i < count; i++) { GameObject option = (GameObject)GameObject.Instantiate(buttonPrefab, new Vector3(x, y, 0), Quaternion.identity); option.transform.SetParent(shoesMenu.transform, false); option.name = i.ToString(); Texture2D shoesTex; if (gender == "Female") { shoesTex = ItemInformation.GetFemaleShoes(shoes).tex; } else { shoesTex = ItemInformation.GetMaleShoes(shoes).tex; } option.transform.GetChild(0).GetComponent <Image>().sprite = Sprite.Create(shoesTex, new Rect(0, 0, shoesTex.width, shoesTex.height), new Vector2(0.5f, 0.5f)); option.transform.GetChild(0).GetComponent <Image>().color = bottomsColor; buttons.AddToButtons(option.GetComponent <Button>()); if (i == shoes) { buttons.currSelectedButton = option.GetComponent <Button>(); } if (i % 2 == 0) { x = 33.5f; } else { x = -33.5f; y -= 60; } } activeObj = "Shoes"; }