- Home /
Low FPS on empty scene
I made an empty scene with just one game object to display FPS. When I run on my android phone, I get pretty bad stats.
Android Unity internal profiler stats:
cpu-player> min: 6.3 max: 25.7 avg: 20.3
cpu-ogles-drv> min: 0.2 max: 5.1 avg: 0.3
cpu-present> min: 0.3 max: 17.0 avg: 0.8
frametime> min: 15.2 max: 26.2 avg: 21.5
draw-call #> min: 2 max: 2 avg: 2 | batched: 0
tris #> min: 18 max: 18 avg: 18 | batched: 0
verts #> min: 40 max: 40 avg: 40 | batched: 0
Here is the script attached to my one game object to display FPS.
using UnityEngine;
using System.Collections;
public class DebugHUD : MonoBehaviour
{
public static DebugHUD debugHUD;
public bool debugOn = true;
public float updateInterval = 0.5f;
private int frames = 0;
private float duration = 0;
// Singleton
void Awake ()
{
if (debugHUD == null) {
DontDestroyOnLoad (gameObject);
debugHUD = this;
} else if (debugHUD != this) {
Destroy (gameObject);
}
if (!Debug.isDebugBuild)
debugOn = false;
if (guiText) {
guiText.fontSize = (int)(Screen.width * 0.05f);
if (debugOn)
StartCoroutine (UpdateFPS ());
else
guiText.enabled = false;
} else {
Debug.LogWarning ("Please attach GUIText component to game object");
}
}
void Update ()
{
++frames;
duration += Time.deltaTime;
}
// Display FPS data
IEnumerator UpdateFPS ()
{
float fps = 0;
string format;
// Cache reference to components
GUIText FPStext = guiText;
Material material = FPStext.material;
while (true) {
duration = 0;
frames = 0;
yield return new WaitForSeconds (updateInterval);
// Only do division once
duration = 1 / duration;
// Only update if FPS changes
if (fps - (frames * duration) < 0.01 && fps - (frames * duration) > -0.01) {
continue;
}
fps = frames * duration;
format = System.String.Format ("{0:F2} FPS", fps);
FPStext.text = format;
if (fps < 30)
material.color = Color.yellow;
else if (fps < 10)
material.color = Color.red;
else
material.color = Color.green;
}
}
}
The internal profiler says around 45fps and that's what my script displays. Does this mean that I won't be able to get my fps any higher than this on this device? It's kind of disheartening that I have made probably the most efficient possible app and it only gets 45 fps.
Answer by Jlu · Mar 16, 2014 at 04:51 PM
Try adjusting the target framerate:
Application.targetFrameRate = 60;
Remember, that you probably shouldn't exceed 60 fps in production, so you don't waste precious resources (and battery on mobile, of course).
The default is -1 which means that it is using the highest framerate possible. $$anonymous$$y framerate is 45 which is below 60.
Answer by Raimi · Oct 09, 2014 at 07:25 PM
Go to...
Edit > project settings > quality
and deselect Beautiful and Fantastic under the android quality settings. you will see a huge increase in fps. Also tweak some of the other settings to get what you want.
Answer by leohotluz · Jan 14, 2019 at 11:42 PM
Same problem, in unity 2017 and 2018. Empty scene, empty project, quality on lowest, 50fps in maximized game view.
The weight should be zero, and the fps go to 2000 as it did in unity 5.6 ... it seems that the performance of unity has gotten much worse.
Answer by KenSteelyHunter · Mar 12 at 02:06 PM
same problem, ; unity given me 50 fps on my redmi note 5 in empty scene without dyn lights (baked); and 29 fps with ONE mesh in space; when I ran first my try (with player, 2poly floor and static light and few materials w\o textures) I get 15 fps.; in this time, I copyed my project into Unreal, with dynamic lights, with dynamic materials, with textures, ;with many meshes and I was get 40-50fps on the SAME my redmi note 5!; . rly idn HOW making games on unity now... idn...