Unity3d 帧率设置 及在游戏运行时显示帧率

本文介绍了如何在Unity3d中通过代码设置游戏帧率,特别是针对手机游戏通常设置为30帧。然而,帧率设置可能受到垂直同步的影响,当开启垂直同步时,帧率将根据屏幕刷新率决定。关闭垂直同步后,可以成功设置游戏帧率为100帧。同时,文章提供了一个在游戏中显示帧率的代码片段。
摘要由CSDN通过智能技术生成
               

在Unity3d 中可以通过代码设置 来限定游戏帧率。

Application.targetFrameRate=-1;

设置为 -1 表示不限定帧率。 转自http://blog.csdn.net/huutu

一般在手机游戏中我们限定帧率为30 就OK了。

Application.targetFrameRate=30;

但是把这个代码添加到工程之后,在Unity中运行起来发现并没有什么卵用。。。。

转自http://blog.csdn.net/huutu

于是到官网查看资料

http://docs.unity3d.com/ScriptReference/Application-targetFrameRate.html

Application.targetFrameRatepublic static int targetFrameRate;DescriptionInstructs game to try to render at a specified frame rate.Setting targetFrameRate to -1 (the default) makes standalone games render as fast as they
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值