- Home /
Question by
kakatheplayer · Feb 03, 2018 at 01:34 AM ·
buildplayerbug
I can't change my game from fullscreen to windowed.
I have this script and when I build a game everything is working but not the fullscreen toggle. Thanks in Advance :D
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
using TMPro;
public class OptionsMenu : MonoBehaviour
{
public TMP_Dropdown resolutionDropdown;
public AudioMixer Mixer;
Resolution[] resolutions;
void Start()
{
resolutions = Screen.resolutions;
resolutionDropdown.ClearOptions();
List<string> options = new List<string>();
int CurrentResolutionIndex = 0;
for (int i = 0; i < resolutions.Length; i++)
{
string option = resolutions[i].width + "X" + resolutions[i].height;
options.Add(option);
if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height)
{
CurrentResolutionIndex = i;
}
}
resolutionDropdown.AddOptions(options);
resolutionDropdown.value = CurrentResolutionIndex;
resolutionDropdown.RefreshShownValue();
}
public void SetResolution(int resolutionIndex)
{
Resolution resolution = resolutions[resolutionIndex];
Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen);
}
public void SetVolume(float volume)
{
Mixer.SetFloat("volume", volume);
}
public void Quality(int QualityIndex)
{
QualitySettings.SetQualityLevel(QualityIndex);
}
public void SetFullscreen(bool IsFullScreen)
{
Screen.fullScreen = IsFullScreen;
}
}
przechwytywanie.png
(23.0 kB)
przechwytywanie.png
(16.5 kB)
Comment
Your screenshots are named przechwytywanie. At least in my browser. Are you from $$anonymous$$nd?