init commit
This commit is contained in:
9811
Assets/Others/Canvas.prefab
Normal file
9811
Assets/Others/Canvas.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Others/Canvas.prefab.meta
Normal file
7
Assets/Others/Canvas.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 831091d86766b4c7ab32e38d3605e142
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
50
Assets/Others/FPS.cs
Normal file
50
Assets/Others/FPS.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class FPS : MonoBehaviour
|
||||
{
|
||||
public static bool showFPS = true;
|
||||
public static float fps;
|
||||
private static float frameCount;
|
||||
private static float elapse;
|
||||
private GUIStyle _fpsStyle;
|
||||
public GUIStyle fpsStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_fpsStyle == null)
|
||||
{
|
||||
int h = Screen.height;
|
||||
_fpsStyle = new GUIStyle();
|
||||
_fpsStyle.alignment = TextAnchor.UpperLeft;
|
||||
_fpsStyle.fontSize = h * 2 / 100;
|
||||
_fpsStyle.normal.textColor = Color.magenta;
|
||||
}
|
||||
return _fpsStyle;
|
||||
}
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
Application.targetFrameRate = 60;
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
frameCount++;
|
||||
elapse += Time.unscaledDeltaTime;
|
||||
if (elapse >= 1)
|
||||
{
|
||||
fps = frameCount / elapse;
|
||||
elapse = 0;
|
||||
frameCount = 0;
|
||||
}
|
||||
if (!showFPS) return;
|
||||
|
||||
string text = string.Format("FPS: {0:0.}", fps);
|
||||
int w = Screen.width, h = Screen.height;
|
||||
Rect rect = new Rect(20, h * 0.4f, w * 0.5f, h * 2 / 100);
|
||||
GUI.Label(rect, text, fpsStyle);
|
||||
}
|
||||
}
|
||||
11
Assets/Others/FPS.cs.meta
Normal file
11
Assets/Others/FPS.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85c40cec8fd81416f856a795908f973f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
23
Assets/Others/TestUI.cs
Normal file
23
Assets/Others/TestUI.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class TestUI : MonoBehaviour
|
||||
{
|
||||
public TMP_Dropdown QualityDropdown;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
InitDropdown();
|
||||
}
|
||||
|
||||
private void InitDropdown()
|
||||
{
|
||||
QualityDropdown.ClearOptions();
|
||||
QualityDropdown.AddOptions(QualitySettings.names.ToList());
|
||||
QualityDropdown.value = QualitySettings.GetQualityLevel();
|
||||
QualityDropdown.onValueChanged.AddListener(index => QualitySettings.SetQualityLevel(index));
|
||||
}
|
||||
}
|
||||
11
Assets/Others/TestUI.cs.meta
Normal file
11
Assets/Others/TestUI.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bba38d504dcf40e8b7ab56b78213f50
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user