Showing Frame Rate Info in the Unity scene using Custom Script failed
I want to lock the framerate of my scene to 30fps, then I learned from this post that fps info in Editor Stat isn't reliable, that's why my fps is still around 100. This is my script for setting the framerate (vSync also has been set into Don't Sync) :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TargetFramerate : MonoBehaviour {
public int frame_rate = 30;
void Start () {
}
void Awake (){
QualitySettings.vSyncCount = 0;
Application.targetFrameRate = frame_rate;
}
void Update () {
if (frame_rate != Application.targetFrameRate) {
Application.targetFrameRate = frame_rate;
}
}
}
But it doesn't work. Where should I put this script ? I put it in one of my GameObject with camera attached on it. By the way, I'm also using SteamVR camera script for my Game Objects (for HMD device), is it affecting this script ?
Also I'm using custom script from Unity Standard Assets to display my framerate. Here's how it looks like on the scene using FPSCounter from Standard Assets, it works on the Game tab, but it doesn't show on the device (I'm using HMD- HTC Vive).
My framerate lock code above doesn't seem to work, since the FPS is still reaching 90fps. Any advice ?
Your answer
Follow this Question
Related Questions
Setting Frame Rate failed. 0 Answers
Basic FPS help! 2 Answers
Animations Bad Scripting | Controller Script Buggy | Collider Problem | Beginner Here! 0 Answers
sound buzzing enemy dies 1 Answer
About mobile FPS Sprint 1 Answer