- Home /
Weird behaviour in Application.LoadLevel()
Hi. I'm creating a tetris-like game for my boss, and I'm experiencing an weird behaviour.
In my game I have two scenes only. The first scene is the menu, and the second is the game itself.
When I first open the game (editor, android or iOS), it loads all the menu. When I go to the game, it loads the game. But in the game scene I have a button to go back to the menu. And that's the weird part.
I press the button and the game takes about 5 seconds to show the menu, but I can press the buttons in the menu, even when the menu is not visible. For example: the button to go back to the menu is in the same position as the button to go to the game. So if I double press the "go back button", the game loads the menu, and loads the game again. (because the second time I pressed the button, I did press the button to go the game)
Anyone have any thoughts? (did I make myself clear? English is not my main language... xD)
[EDIT] I forgot to say, but in the menu scene, EVERYTHING visible comes from the OnGUI function, except the background, which are several plans with the same texture. And I have one function that gets the resolution and force the camera to be in 3:4 aspect ratio.
[EDIT 2]
The menu button is:
// Start Game
if( GUI.Button(Rect(playGameX,playGameY,larguraBotao,alturaBotao),"",playGameStyle) ){
Application.LoadLevel("Game");
}
And the button that goes back to the menu is:
if( GUI.Button( Rect(yesX,yesY,larguraNoYes,alturaNoYes),"",yesStyle ) ){
Application.LoadLevel("Menu");
}
well no problem there...
maybe the camera script is the issue...
hard to say, not much to go on here.. what are you seeing during those 5 seconds?
still the game scene?