unity设置帧率

cs 复制代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Run : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("hello unity");

        Application.targetFrameRate = 100;

    }

    // Update is called once per frame
    void Update()
    {
        Debug.Log(Time.time);
        print("---------------------------");
        Debug.Log(Time.deltaTime);


    }
}

Time.time当前时间

Time.deltaTime固定的与上一帧的时间

Application.targetFrameRate = 100;设置运行的帧率一秒运行多少次

Time.deltaTime 约等于1/ Application.targetFrameRate 不是完全按时设定的来,是尽量接近。

相关推荐
一线灵3 小时前
跨平台游戏引擎 Axmol-2.6.1 发布
游戏引擎
Clank的游戏栈7 小时前
Unity基于GraphView的可视化关卡编辑器开发指南
unity·编辑器·游戏引擎
海尔辛15 小时前
Unity UI 性能优化--Sprite 篇
ui·unity·性能优化
三巧21 小时前
Godot 敌人生成半径和围墙不匹配,导致敌人错误的生成在围墙外的解决代码
游戏引擎·godot
技术小甜甜21 小时前
【Godot引擎】如何使用内置的全局搜索功能提升开发效率
游戏引擎·godot
技术小甜甜21 小时前
【Godot】如何导出 Release 版本的安卓项目
android·游戏引擎·godot
XR-AI-JK1 天前
Unity VR/MR开发-VR设备与适用场景分析
unity·vr·mr
ChiLi_Lin1 天前
Unity异常上报飞书工具
unity·游戏引擎·飞书
Magnum Lehar1 天前
vulkan游戏引擎的makefile启动环境实现
游戏引擎
地狱为王2 天前
基于VLC的Unity视频播放器(四)
unity·游戏引擎·音视频