- Home /
Question by
Himani_123 · Jun 10, 2014 at 01:14 PM ·
on start a new game texture is not appearing
my game have 2 level named as "game" and "menu".In my game level i am opening an window that ask for save or not.i just simple click no menu level get open.then again when i click on new game button in menu game level load but texture does not appear on my cube.i am not using any code for save functionality yet.then also it is not working. on start a game texture appear .but click on back i move to menu level ,on again start a game texture doesnot appear. where am i going wrong..??
void Start ()
{
if (MainMenu1.New == true) {
dialogScript = gameObject.GetComponent<dialog> ();
for (int a=GridHeight; a>0; a--) {
for (int b=0; b<GridWidth; b++) {
g = Instantiate (gemprefab, new Vector3 (b, a, 0), Quaternion.identity) as GameObject;
g.name = "gem" + t;
g.transform.parent = gameObject.transform;
gemComponent = g.GetComponent<Gem> ();
gems.Add (gemComponent);
//gems1.Add (gemComponent);
t++;
if (a == 1 && b == 3) {
gemComponent.cube.renderer.enabled = false;
}
}
}
gameObject.transform.position = new Vector3 (-2.5f, -2.5f, 0);
positionArray = new Vector3[gems.Count];
for (int i = 0; i < gems.Count; i++) {
positionArray [i] = gems [i].transform.position;
}
ChangePosition();
MainMenu1.New=false;
}
}
}
void OnGUI() {
GUI.Label( new Rect( 40, 40, 120, 50 ), "Timer: " +timerFormatted , mystyle );
GUI.Label( new Rect( 400, 40, 120, 50 ), "Moves: " +click , mystyle );
if (GUI.Button (new Rect (10, 350, 70, 20), "Back "))
{
displayDialog=true;
//Application.LoadLevel("level02");
}
if (displayDialog) {
windowRect = GUI.Window (0, windowRect, WindowFunction, "Save !!!");
}
if (GUI.Button (new Rect (200, 350, 70, 20), "Shuffle "))
{
ChangePosition();
}
if (GUI.Button (new Rect (400, 350, 70, 20), "Settings "))
{
Application.LoadLevel("Settings");
}
}
public void WindowFunction (int windowID)
{
GUI.Label( new Rect( 40, 40, 120, 50 ), "Do you want to save ?? ",mystyle );
if (GUI.Button (new Rect (10, 70, 70, 20), "Yes "))
{
Hello();
Application.LoadLevel("level02");
}
if (GUI.Button (new Rect (120, 70, 70, 20), "No "))
{
Application.LoadLevel("level02");
}
}
Comment
Your answer
Follow this Question
Related Questions
Cloud recognition in Vuforia 0 Answers
Running Unity3D with Awesomium an android device 1 Answer
Character Axes Rotation Problem 3 Answers
How to read two separate values from the same SerialPort? 1 Answer
Post image to facebook wall 0 Answers