Кто-нибудь реализовывал внутриигровой аналог "выпадающего меню с разрешениями, которое появляется при запуске standalone композиции"?
Лениво делать самостоятельно... может у кого есть готовое решение .
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class DD1 : MonoBehaviour
{
Rect DropDownRect = new Rect(100, 100, 160, 28);
private Vector2 ListScrollPos;
public bool DropdownVisible = false;
public int SelectedListItem = -1;
private List<GuiListItem> MyListOfStuff;
public string SelectedItemCaption;
public string ButtonText;
Resolution[] resolutions;
public class GuiListItem
{
public bool Selected;
public int X;
public int Y;
public string Name;
//
public GuiListItem(bool mSelected, int wX, int hY)
{
Selected = mSelected;
X = wX;
Y = hY;
Name = System.Convert.ToString(X) + "x" + System.Convert.ToString(Y);
}
public GuiListItem(int wX, int hY)
{
Selected = false;
X = wX;
Y = hY;
Name = System.Convert.ToString(X) + "x" + System.Convert.ToString(Y);
}
public void enable()
{
Selected = true;
}
public void disable()
{
Selected = false;
}
}
void Start()
{
resolutions = Screen.resolutions;
MyListOfStuff = new List<GuiListItem>();
for (int i = 0; i < resolutions.Length; i++)
{
MyListOfStuff.Add(new GuiListItem(resolutions[i].width, resolutions[i].height));
}
}
void OnGUI()
{
if (DropdownVisible == true)
{
GUILayout.BeginArea(new Rect(DropDownRect.left, DropDownRect.top + DropDownRect.height, 160, 128), "", "box");
ListScrollPos = GUILayout.BeginScrollView(ListScrollPos, false, true);
GUILayout.BeginVertical(GUILayout.Width(120));
for (int i = 0; i < MyListOfStuff.Count; i++)
{
if (MyListOfStuff[i].Selected == false && GUILayout.Button(MyListOfStuff[i].Name))
{
if (SelectedListItem != -1)
MyListOfStuff[SelectedListItem].disable();
SelectedListItem = i;
MyListOfStuff[SelectedListItem].enable();
DropdownVisible = false;
Screen.SetResolution(MyListOfStuff[SelectedListItem].X, MyListOfStuff[SelectedListItem].Y, true, 0);
}
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
GUILayout.EndArea();
}
GUILayout.BeginArea(DropDownRect, "", "box");
GUILayout.BeginHorizontal();
SelectedItemCaption = (SelectedListItem == -1) ? "Select an item..." : MyListOfStuff[SelectedListItem].Name;
ButtonText = (DropdownVisible) ? "<<" : ">>";
GUILayout.TextField(SelectedItemCaption);
DropdownVisible = GUILayout.Toggle(DropdownVisible, ButtonText, "button", GUILayout.Width(32), GUILayout.Height(20));
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
}
if (GUI.Button (Rect (200,15,50,30), "2х"))
{
QualitySettings.currentLevel = QualityLevel.Good;
}
if (GUI.Button (Rect (300,15,50,30), "4х"))
{
QualitySettings.currentLevel = QualityLevel.Fantastic;
}
Neodrop писал(а):Не забываем, что смена режимов операция нагрузная для Рендерера. Для быстрой (в каждом кадре) смены сеттинга, лучше использовать
QualitySettings.IncreaseLevel
QualitySettings.DecreaseLevel
Но вот они то, как раp и не меняют АА.
Neodrop писал(а):Читаем справку, чтобы малость своё "понимание" подправить. Там всё написано.
Scripting Reference писал(а):Increase the current quality level.
IncreaseLevel and DecreaseLevel functions do not apply anti-aliasing changes. If you want to apply anti-aliasing setting in a different quality level, assign currentLevel variable.
Scripting Reference писал(а):Note that changing the quality level can be an expensive operation if the new level has different anti-aliasing setting. It's fine to change the level when applying in-game quality options, but do not try changing it each frame. If you want to dynamically adjust quality level at runtime, use IncreaseLevel and DecreaseLevel functions which do not apply anti-aliasing changes.
Сейчас этот форум просматривают: Yandex [Bot] и гости: 8