Как создать настройки и меню на Unity3D!!!!

preview_player
Показать описание
Всем привет сегодня я покажу как сделать красивое меню с настройками на юнити
Рекомендации по теме
Комментарии
Автор

вот скрипт:


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Settings : MonoBehaviour
{
public AudioMixer audioMixer;
public Dropdown resolutionDropdown;
public Dropdown qualityDropdown;
public Slider volumeSlider;
float currentVolume;
Resolution[] resolutions;

void Start()
{

List<string> options = new List<string>();
resolutions = Screen.resolutions;
int currentResolutionIndex = 0;

for (int i = 0; i < resolutions.Length; i++)
{
string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRate + "Hz";
options.Add(option);
if (resolutions[i].width ==
&& resolutions[i].height ==
currentResolutionIndex = i;
}




}

public void SetVolume(float volume)
{
audioMixer.SetFloat("Volume", volume);
currentVolume = volume;
}
public void SetFullscreen(bool isFullscreen)
{
Screen.fullScreen = isFullscreen;
}

public void SetResolution(int resolutionIndex)
{
Resolution resolution =
Screen.SetResolution(resolution.width,
resolution.height, Screen.fullScreen);
}


public void SetQuality(int qualityIndex)
{



}

public void ExitSettings()
{

}

public void SaveSettings()
{
PlayerPrefs.SetInt("QualitySettingPreference",
qualityDropdown.value);
PlayerPrefs.SetInt("ResolutionPreference",
resolutionDropdown.value);
PlayerPrefs.SetInt("FullscreenPreference",

PlayerPrefs.SetFloat("VolumePreference",
currentVolume);
}

public void LoadSettings(int currentResolutionIndex)
{
if
qualityDropdown.value =

else
qualityDropdown.value = 3;
if
resolutionDropdown.value =

else
resolutionDropdown.value = currentResolutionIndex;
if
Screen.fullScreen =

else
Screen.fullScreen = true;
if
volumeSlider.value =

else
volumeSlider.value =

}
}

Xayrllano