浏览代码

Add a component to set the target frame rate. Unity defaults to 30 fps

on mobile, but ARKit looks best at 60 Hz.
/1.5-preview
Tim Mowrer 6 年前
当前提交
c1dda1f4
共有 2 个文件被更改,包括 47 次插入0 次删除
  1. 36
      Assets/Scripts/SetTargetFramerate.cs
  2. 11
      Assets/Scripts/SetTargetFramerate.cs.meta

36
Assets/Scripts/SetTargetFramerate.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Simple MonoBehaviour to set the Application's targetFrameRate
/// </summary>
public class SetTargetFramerate : MonoBehaviour
{
[SerializeField]
[Tooltip("Sets the application's target frame rate.")]
int m_TargetFrameRate = 60;
/// <summary>
/// Get or set the application's target frame rate.
/// </summary>
public int targetFrameRate
{
get { return m_TargetFrameRate; }
set
{
m_TargetFrameRate = value;
SetFrameRate();
}
}
void SetFrameRate()
{
Application.targetFrameRate = targetFrameRate;
}
void Start()
{
SetFrameRate();
}
}

11
Assets/Scripts/SetTargetFramerate.cs.meta


fileFormatVersion: 2
guid: 1eb9777efa8174381b01d319232f7df5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存