1
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AYellowpaper.SerializedCollections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public class SetTargetFrameRate : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private SerializedDictionary<string, int> frameRateDictionary;
|
||||
[SerializeField] private int startFrameRate;
|
||||
private int currentFrameRate;
|
||||
private void Start()
|
||||
{
|
||||
currentFrameRate = Application.targetFrameRate;
|
||||
}
|
||||
public void SetFrameRate(string key)
|
||||
{
|
||||
if (frameRateDictionary.TryGetValue(key, out var frameRate))
|
||||
{
|
||||
SetFrameRate(frameRate);
|
||||
}else if (int.TryParse(key, out frameRate))
|
||||
{
|
||||
SetFrameRate(frameRate);
|
||||
}
|
||||
}
|
||||
public void SetFrameRate(int frameRate)
|
||||
{
|
||||
Application.targetFrameRate =currentFrameRate = frameRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abf7a0c09f983f0409351183f34dff83
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user