Hi there, I have a problem here and I’ve tried many solutions but it did not work. My main program or my whole project works like this. First, the user will pick a room. For instance bedroom. The program will give different furniture or appliances that is on the bedroom. So the first furniture is the bed. There will be a question that will be asked: “What is the size of your bed?” There will be choices, and the choices are buttons. For instance the chosen size is the first button. Once it is clicked it will load to next scene. In the next scene, the program will ask the user how many bed they have. Then after that there will be next question. The next question is “What is the size of your cabinet?” after choosing the size, it will load to the next scene and ask again the user how many cabinet they have. So after getting the size and number of appliance, there will be a script that will give the summarize of their inputs. After that there will be a button that will load to another scene that will display the objects they have inputted. But my script is not working. It works if the first if statement is correct. I think the problem is that the program is not reading the other if statements if the bed is small and the cabinet is medium. Those are the sizes but if the user choose small bed and small cabinet, it displays. What is wrong with my program? Please I really need help.
using UnityEngine;
using System.Collections;
public class afinish : MonoBehaviour {
public static string Kama1 = bedA.kamaA;
public static string Kabinet1 = cabinetA.kabinetA;
public static string Kama2 = bedB.kamaB;
public static string Kabinet2 = cabinetB.kabinetB;
public GUIStyle Display1;
public GUIStyle Display;
public GameObject una; //bed
public GameObject una1; //cabinet
public GameObject first; //bed
public GameObject first1; //cabine
public float guiPlacementX1;
public float guiPlacementY1;
public float guiPlacementX2;
public float guiPlacementY2;
bool hide = true;
bool hide1 = true;
void OnGUI(){
if (hide && GUI.Button (new Rect (Screen.width * guiPlacementX1, Screen.height * guiPlacementY1, Screen.width * .2f, Screen.height * .3f), "", Display)) {
//Chair
hide = false;
//small bed
if (int.Parse (Kama1) == 1) {
GameObject kama1 = Instantiate (una) as GameObject;
kama1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama1.transform.localScale = new Vector3 (100f, 100f, 100f);
kama1.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log ("gumana ka naman. :(((");
}
if (int.Parse (Kama1) == 2) {
GameObject kama1 = Instantiate (una) as GameObject;
kama1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama1.transform.localScale = new Vector3 (100f, 100f, 100f);
kama1.transform.Rotate (0f, 88.33871f, 0f);
GameObject kama2 = Instantiate (una) as GameObject;
kama2.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama2.transform.localScale = new Vector3 (100f, 100f, 100f);
kama2.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log (" gumana ka naman. :(((");
}
if (int.Parse (Kama1) == 3) {
GameObject kama1 = Instantiate (una) as GameObject;
kama1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama1.transform.localScale = new Vector3 (100f, 100f, 100f);
kama1.transform.Rotate (0f, 88.33871f, 0f);
GameObject kama2 = Instantiate (una) as GameObject;
kama2.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama2.transform.localScale = new Vector3 (100f, 100f, 100f);
kama2.transform.Rotate (0f, 88.33871f, 0f);
GameObject kama3 = Instantiate (una) as GameObject;
kama3.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama3.transform.localScale = new Vector3 (100f, 100f, 100f);
kama3.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log ("gumana ka naman. :(((");
}
//cabinet
if (int.Parse (Kabinet1) == 1) {
GameObject kabinet1 = Instantiate (una1) as GameObject;
kabinet1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet1.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet1.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log ("gumana ka naman. :(((");
}
if (int.Parse (Kabinet1) == 2) {
GameObject kabinet1 = Instantiate (una1) as GameObject;
kabinet1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet1.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet1.transform.Rotate (0f, 88.33871f, 0f);
GameObject kabinet2 = Instantiate (una1) as GameObject;
kabinet2.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet2.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet2.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log ("gumana ka naman. :(((");
}
if (int.Parse (Kabinet1) == 3) {
GameObject kabinet1 = Instantiate (una1) as GameObject;
kabinet1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet1.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet1.transform.Rotate (0f, 88.33871f, 0f);
GameObject kabinet2 = Instantiate (una1) as GameObject;
kabinet2.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet2.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet2.transform.Rotate (0f, 88.33871f, 0f);
GameObject kabinet3 = Instantiate (una1) as GameObject;
kabinet3.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet3.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet3.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log (" gumana ka naman. :(((");
}
}
if (hide1 && GUI.Button (new Rect (Screen.width * guiPlacementX2, Screen.height * guiPlacementY2, Screen.width * .2f, Screen.height * .3f), "", Display1)) {
hide1 = false;
//bed
if (int.Parse (Kama2) == 1) {
GameObject kama1 = Instantiate (first) as GameObject;
kama1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama1.transform.localScale = new Vector3 (100f, 100f, 100f);
kama1.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log("gumana ka naman. :(((");
}
if (int.Parse (Kama2) == 2) {
GameObject kama1 = Instantiate (first) as GameObject;
kama1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama1.transform.localScale = new Vector3 (100f, 100f, 100f);
kama1.transform.Rotate (0f, 88.33871f, 0f);
GameObject kama2 = Instantiate (first) as GameObject;
kama2.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama2.transform.localScale = new Vector3 (100f, 100f, 100f);
kama2.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log("gumana ka naman. :(((");
}
if (int.Parse (Kama2) == 3) {
GameObject kama1 = Instantiate (first) as GameObject;
kama1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama1.transform.localScale = new Vector3 (100f, 100f, 100f);
kama1.transform.Rotate (0f, 88.33871f, 0f);
GameObject kama2 = Instantiate (first) as GameObject;
kama2.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama2.transform.localScale = new Vector3 (100f, 100f, 100f);
kama2.transform.Rotate (0f, 88.33871f, 0f);
GameObject kama3 = Instantiate (first) as GameObject;
kama3.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kama3.transform.localScale = new Vector3 (100f, 100f, 100f);
kama3.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log("gumana ka naman. :(((");
}
//cabinet
if (int.Parse (Kabinet2) == 1) {
GameObject kabinet1 = Instantiate (first1) as GameObject;
kabinet1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet1.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet1.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log("gumana ka naman. :(((");
}
if (int.Parse (Kabinet2) == 2) {
GameObject kabinet1 = Instantiate (first1) as GameObject;
kabinet1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet1.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet1.transform.Rotate (0f, 88.33871f, 0f);
GameObject kabinet2 = Instantiate (first1) as GameObject;
kabinet2.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet2.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet2.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log("gumana ka naman. :(((");
}
if (int.Parse (Kabinet2) == 3) {
GameObject kabinet1 = Instantiate (first1) as GameObject;
kabinet1.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet1.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet1.transform.Rotate (0f, 88.33871f, 0f);
GameObject kabinet2 = Instantiate (first1) as GameObject;
kabinet2.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet2.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet2.transform.Rotate (0f, 88.33871f, 0f);
GameObject kabinet3 = Instantiate (first1) as GameObject;
kabinet3.transform.position = new Vector3 (-1.405897f, 1.676556f, 378.3273f);
kabinet3.transform.localScale = new Vector3 (100f, 100f, 100f);
kabinet3.transform.Rotate (0f, 88.33871f, 0f);
Debug.Log("gumana ka naman. :(((");
}
}
}
}