public class menu : MonoBehaviour {
int userint;
public GameObject torsoSlots;
void Awake()
{
userint = 0;
for (int i = 0; i < 10; i++)
{
torsoSlots*.active = false;*
}
}
void OnGUI()
{
if (userint == 0)
{
GUI.Box(new Rect(Screen.width - 220, 20, 200, 200), “Fit”);
if (GUI.Button(new Rect(Screen.width - 170, 40, 100, 25), “Head”))
{
userint = 1;
}
if (GUI.Button(new Rect(Screen.width - 170, 70, 100, 25), “Torso”))
{
userint = 2;
while(userint == 2) ;
{
for (int torso = 0; torso < 10; torso++)
{
torsoSlots[torso].active=true;
}
}
I’m trying to create a char builder, in public torsoSlots[], there is game object I’m defined. When I click on Torso button unity stop responding. Is it because I did something wrong with code ( enless loop etc ) or just a unity bug.
Thanks in advance…
I editted your question so the code is correctly formatted. You might care to learn how to do this for yourself.
– Graham-Dunnett