我刚刚创建了一个新项目,并在其中构建了一个开放场景,其中包含几个精灵,同样的场景以统一的方式运行4.7和60FPS,但我无法在单位5.6中获得它。我只有一个简单的脚本(fps计数器),一个简单的动画(1个叶子),一个场景中的15个精灵和带有文本的画布,只有5个绘制调用。我甚至手工优化了精灵网格,因此它们的透支较少。它发生在Android和PC上
使用我的fps脚本和内部分析器:
Unity4.7 > PC 450fps | Android 60fps
Unity5.6 > PC 110fps | Android 35-50fps
这些是我的设置
Tree and view screenshot
Settings
这是FPS脚本
using UnityEngine;
using UnityEngine.UI;
public class FrameCounter : MonoBehaviour
{
public float refreshInterval;
private Text label;
private float delta;
private float frames;
private float res;
// Use this for initialization
void Start ()
{
label = GetComponent<Text>();
delta = 0;
frames = 0;
}
// Update is called once per frame
void Update ()
{
frames++;
delta += Time.deltaTime;
if (delta > refreshInterval)
{
res = delta / frames;
label.text = 1f / res + " (" + 1000f * res + "ms)";
delta = 0;
frames = 0;
}
}
}
经过一些设置调整:关闭32位缓冲区,从图形API列表中删除OpenGLES2,将质量设置设置为最快我获得了一些性能提升,但还不够。无法获得60FPS :(这是调整后的内部分析器结果:
02-21 04:58:07.719 30216 30291 D Unity : Android Unity internal profiler stats:
02-21 04:58:07.719 30216 30291 D Unity : cpu-player> min: 12.7 max: 36.4 avg: 20.5
02-21 04:58:07.719 30216 30291 D Unity : cpu-ogles-drv> min: 0.0 max: 0.0 avg: 0.0
02-21 04:58:07.719 30216 30291 D Unity : gpu> min: 0.0 max: 0.0 avg: 0.0
02-21 04:58:07.720 30216 30291 D Unity : cpu-present> min: -20.0 max: 1.4 avg: -1.6
02-21 04:58:07.720 30216 30291 D Unity : frametime> min: 13.0 max: 34.6 avg: 18.9
02-21 04:58:07.720 30216 30291 D Unity : batches> min: 5 max: 5 avg: 5
02-21 04:58:07.720 30216 30291 D Unity : draw calls> min: 5 max: 5 avg: 5
02-21 04:58:07.720 30216 30291 D Unity : tris> min: 274 max: 274 avg: 274
02-21 04:58:07.720 30216 30291 D Unity : verts> min: 348 max: 348 avg: 348
02-21 04:58:07.720 30216 30291 D Unity : dynamic batching> batched draw calls: 13 batches: 1 tris: 226 verts: 252
02-21 04:58:07.720 30216 30291 D Unity : static batching> batched draw calls: 0 batches: 0 tris: 0 verts: 0
02-21 04:58:07.720 30216 30291 D Unity : player-detail> physx: 0.0 animation: 0.0 culling 0.0 skinning: 0.0 batching: 0.3 render: -0.3 fixed-update-count: 0 .. 0
02-21 04:58:07.720 30216 30291 D Unity : managed-scripts> update: 0.0 fixedUpdate: 0.0 coroutines: 0.0
02-21 04:58:07.720 30216 30291 D Unity : managed-memory> used heap: 372736 allocated heap: 512000, max number of collections: 0 collection total duration: 0.0
02-21 04:58:07.720 30216 30291 D Unity : ----------------------------------------
我有什么问题吗?