I want to start my web-player in full-screen mode and I want to disable mouse cursor. I made a research in this forum and found several code examples for that purpose. But I couldn’t manage to make it work.
Honestly, I was thinking the line below will be enough for full-screen start. But for some reason it doesn’t
Screen.fullScreen = true;
Here is another code which I found in this forum. I modified it a little bit. Please tell me what I am doing wrong.
If I missed a topic related to this issue please provide me a link for that and I can study more. I also found several topics related to “press ESC to exit full-screen mode” messsage. But I’m fine with that.
The only reason why I want full-screen is because of the playability. On my Test FPS scene, if player clicks anywhere except web-player, than the movement keys become disabled. I want to overcome this issue by starting the game in full-screen mode
The webplayer is designed so that the user needs to click once before it can go fullscreen. The idea is that it prevents the game from “taking over” before the player has realised what is happening.
I’m totally OK with click web-player before FullScreen action. But, what might be the mistake on the code I wrote above? I wonder why it works on Google Chrome but not on Internet Explorer ?
This is kind of disappointing because I’m trying to set up an OSX screensaver using the template from the wiki… it uses the webplayer embedded into webkit and although it can start out with a full-screen-sized presentation, it’s not actually in Unity’s fullscreen mode, and so runs noticeably slower. The user would have to click the webplayer in order to go into proper fullscreen and get a massive speed boost, but this will end the screensaver.
I did find strangely enough that if the user clicks on the screensaver in the preview window (in system prefs panel), then goes to test the saver, it will allow it to go into fullscreen, which is pretty strange because I kinda thought that going into full-size display meant the screensaver is relaunched from the start, so how does it know that a click was made in preview mode and not in the full mode?
Is there some kind of preference that gets written or something, which can be overriden? The way I see it, UT is kind of trying to play the role of policeman in an area which should really be up to the user?
mock pout
Isn’t there some way to get the webplayer to start up in fullscreen without any user input? Like, maybe the html in the page can send some kind of a signal or focus to the unity player to cause it to think it’s been clicked on?
It might be possible to send a fake mouse click to the plugin using javascripting… been fiddling around with a few possibilities but it doesn’t work so far. I tried putting fake clicks in the window.onload function but maybe it’s too soon and needs a bit of delay before sending? Or more research needed. It’s a little sucky having your framerate clamped
Still, for the focus issue here is one method that worked for me without using up those CPU’s using a Unity-sided scripting approach (but still requires the user to click once):
First, start with a major game manager style class and add a boolean member variable, bMouseClicked set to false.
Then, when the mouse is clicked set this variable (use OnGUI() if you like).
Then, in your Start() put up a message asking the user to click on the screen (GUIText works well for this). Then, at the end of the Start(), start a coroutine and have it loop on the condition of Screen.fullScreen and set it to true there too. Once the mouse is clicked the screen will be focused and then it will go full Screen and release the thread loop.
a little off-topic but could not pass without asking: How did you manage to remove the text saying “press ESC to exit full-screen mode” in your test scene? I searched the forum for this but did not find any answers to that, and then I opened new topic [1] about this, no answer yet.