Тёмный

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

Xayrllano
Подписаться 184
Просмотров 57
50% 1

Всем привет сегодня я покажу как сделать красивое меню с настройками на юнити

Опубликовано:

 

8 дек 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 2   
@user-tt1zt3cq2y
@user-tt1zt3cq2y Месяц назад
Спасибо хороший видео
@user-tw4es8bi5c
@user-tw4es8bi5c 6 месяцев назад
вот скрипт: 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() { resolutionDropdown.ClearOptions(); List options = new List(); 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 == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) currentResolutionIndex = i; } resolutionDropdown.AddOptions(options); resolutionDropdown.RefreshShownValue(); LoadSettings(currentResolutionIndex); } 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 = resolutions[resolutionIndex]; Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen); } public void SetQuality(int qualityIndex) { QualitySettings.SetQualityLevel(qualityIndex); } public void ExitSettings() { SceneManager.LoadScene("Level"); } public void SaveSettings() { PlayerPrefs.SetInt("QualitySettingPreference", qualityDropdown.value); PlayerPrefs.SetInt("ResolutionPreference", resolutionDropdown.value); PlayerPrefs.SetInt("FullscreenPreference", System.Convert.ToInt32(Screen.fullScreen)); PlayerPrefs.SetFloat("VolumePreference", currentVolume); } public void LoadSettings(int currentResolutionIndex) { if (PlayerPrefs.HasKey("QualitySettingPreference")) qualityDropdown.value = PlayerPrefs.GetInt("QualitySettingPreference"); else qualityDropdown.value = 3; if (PlayerPrefs.HasKey("ResolutionPreference")) resolutionDropdown.value = PlayerPrefs.GetInt("ResolutionPreference"); else resolutionDropdown.value = currentResolutionIndex; if (PlayerPrefs.HasKey("FullscreenPreference")) Screen.fullScreen = System.Convert.ToBoolean(PlayerPrefs.GetInt("FullscreenPreference")); else Screen.fullScreen = true; if (PlayerPrefs.HasKey("VolumePreference")) volumeSlider.value = PlayerPrefs.GetFloat("VolumePreference"); else volumeSlider.value = PlayerPrefs.GetFloat("VolumePreference"); } }
Далее
Кошка-ГОНЧАР #шортс #shorts
00:28
Просмотров 556 тыс.
How To Make a Countdown Timer in Unity
12:33
Просмотров 63 тыс.
31 portals of impossible shape
35:50
Просмотров 654 тыс.
Анимация для новичков в Blender
16:58