- Sort Posts
- 5 replies
- Last post
#define kFPS 60
#define kFPS 60
No, you need it in a script.
Below is an example script that you could use - simply attach it to your ARCamera.
This will also display the current FPS, though you will need to experiment a little.
Please also try the Unity forums at the Unity web site to get up to speed with Unity a little more.
N
using UnityEngine;
using System.Collections;
public class FPSScript : MonoBehaviour {
public float updateInterval = 0.5F;
private float lastInterval;
private int frames = 0;
private float fps;
void Start() {
lastInterval = Time.realtimeSinceStartup;
frames = 0;
Application.targetFrameRate = 60;
}
void OnGUI() {
GUILayout.Label("" + fps.ToString("f2"));
}
void Update() {
++frames;
float timeNow = Time.realtimeSinceStartup;
if (timeNow > lastInterval + updateInterval) {
fps = frames / (timeNow - lastInterval);
frames = 0;
lastInterval = timeNow;
}
}
}
#define kFPS 60
Normally in AppController.mm
However its use is now deprecated
// kFPS define for removed
// you can use Application.targetFrameRate (30 fps by default)
..and it is recommended to use Application.targetFrameRate and just set it to what you want it.
You ought to go to the Unity forums on the Unity web site and do a searchfor this so you can find help more quickly.
N
This code doesn't works well when I extend it to android