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 不是完全按时设定的来,是尽量接近。

相关推荐
淡海水1 小时前
07-03-源码-.NET Core GC标记与扫描
unity·c#·.netcore·gc
上班摸鱼下班游戏9 小时前
从零开始玩转 DOTween
unity·游戏引擎
阿松爱学习15 小时前
【Unity开发】Unity长截图功能实现
unity·c#·游戏引擎
小小数媒成员15 小时前
Rect Transform
游戏·unity·游戏引擎
淡海水21 小时前
07-01-源码-.NET Core GC总览与架构
unity·架构·c#·.netcore·gc
true...1 天前
虚幻里面设置物体显示、隐藏的两种方式
游戏引擎·虚幻
淡海水2 天前
06-03-源码-时间分片与调度策略
unity·c#·gc
郝学胜-神的一滴3 天前
游戏设计:原型与开发 08:我们到底在为谁做游戏
程序人生·游戏·游戏引擎·游戏开发·游戏策划
五仁烧饼3 天前
动手学 Shader Graph(二):溶解与边缘发光
游戏·unity·shader·shader graph
淡海水3 天前
06-02-源码-增量标记算法实现
算法·unity·c#·gc