您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
47 行
1.2 KiB
47 行
1.2 KiB
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.Experimental.Rendering;
|
|
using UnityEngine.Rendering;
|
|
using UnityEngine.Rendering.LWRP;
|
|
|
|
namespace BoatAttack
|
|
{
|
|
public class AppSettings : MonoBehaviour
|
|
{
|
|
public enum RenderRes
|
|
{
|
|
_Native,
|
|
_2440p,
|
|
_1080p,
|
|
_720p
|
|
}
|
|
|
|
public RenderRes maxRenderSize = RenderRes._720p;
|
|
// Use this for initialization
|
|
void Start()
|
|
{
|
|
Application.targetFrameRate = 60;
|
|
|
|
float res;
|
|
|
|
switch (maxRenderSize)
|
|
{
|
|
case RenderRes._720p:
|
|
res = 720f;
|
|
break;
|
|
case RenderRes._1080p:
|
|
res = 1080f;
|
|
break;
|
|
case RenderRes._2440p:
|
|
res = 2440f;
|
|
break;
|
|
default:
|
|
res = Camera.main.pixelHeight;
|
|
break;
|
|
}
|
|
var renderScale = Mathf.Clamp(res / Camera.main.pixelHeight, 0.1f, 1.0f);
|
|
|
|
LightweightRenderPipeline.asset.renderScale = renderScale;
|
|
}
|
|
}
|
|
}
|