- Home /
Toggle full screen double click issue
Hello, I am trying to make a full screen button for my webGL project. I have tried a few different options and I always run into the same problem. The issue I am having is having to double click the button to activate full screen. To exit full screen with the button, I never have to double click. Does anyone know any solutions to this issue?
Also highly unlikely, but if it is a quirk of Screen.fullScreen how can I solve this?
Here are the following things I have tried, which is getting called on click on the button:
public function toggleFullScreen () {
Screen.fullScreen = !Screen.fullScreen;
}
and
public function toggleFullScreen () {
if (Screen.fullScreen == !Screen.fullScreen) {
Screen.fullScreen = false;
}
else {
Screen.fullScreen = !Screen.fullScreen;
}
}
and
public function toggleFullScreen () {
if (!Screen.fullScreen) {
Screen.fullScreen = true;
}
else {
Screen.fullScreen = !Screen.fullScreen;
}
}
Answer by QuantumCookies · May 31, 2018 at 07:31 AM
Going fullscreen is supported but in your code it looks fine, I need you to provide more like the double click that you are using. Here is the documentation for fullscreen: https://docs.unity3d.com/Manual/webgl-cursorfullscreen.html
Answer by octav88 · Feb 24 at 08:08 AM
I had the same issue and to solve it, I changed the object to be an event trigger instead of a UI Button, so it triggers a OnPointerDown() event. It sets full screen from the first click now.
Your answer
Follow this Question
Related Questions
Fullscreen Toggle Issue 3 Answers
UI Button should stay highlighted on click 2 Answers
How Do I Turn Off Toggle in a ToggleGroup ? 1 Answer
how to make a global Screen resolution? 1 Answer
[Help] FullScreenMode - what is it? 0 Answers