- Home /
Why do I have to click GUI Menu twice to start in Web player?
I've been having terrible trouble trying to get my game to function properly in the web player. It worked fine in stand alone and in the editor.
I think it is something to do with how the web player handles the first click but I don't know how.
When I remove the menu the game starts first click but when I add the menu I have to click once (and nothing happens) and then again to enter the game.
My question is Why is Unity doing this? and Is there a way to work around it?
Here is my test script (attached to the guiTexure):
#pragma strict
var startCamera: Camera;
var fpcCamera: Camera;
function Awake(){
Screen.lockCursor = false;
Screen.showCursor = true;
fpcCamera.enabled = false;
startCamera.enabled = true;
Screen.fullScreen = false;
guiTexture.enabled = true;
}
function Start () {
}
function OnMouseDown() {
Screen.fullScreen = true;
yield WaitForSeconds (0.1);
Screen.lockCursor = true;
guiTexture.enabled = false;
fpcCamera.enabled = true;
startCamera.enabled = false;
}
function Update () {
if (Input.GetKeyDown ("escape")){
Screen.lockCursor = false;
Screen.showCursor = true;
fpcCamera.enabled = false;
startCamera.enabled = true;
Screen.fullScreen = false;
guiTexture.enabled = true;
}
}
I found a way around this. If I use GUI Skins ins$$anonymous$$d, I don't seem to get this problem any more.
Your answer
Follow this Question
Related Questions
Animate GUI Elements 1 Answer
GUI, character selection & general menu 1 Answer
Making a Pause Menu 1 Answer
Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer
Start menu gui wont load scene 2 Answers