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 小时前
如何优化代码适应托管内存?
游戏·unity·游戏引擎
狂人开飞机8 小时前
21、游戏架构设计模式
游戏·游戏引擎·godot
新的瑞拉公主1 天前
Unity游戏发布微信小游戏:从构建到提审
unity·webgl·微信小游戏·开放数据域
狂人开飞机2 天前
14、游戏手感与视觉打磨
游戏·游戏引擎·godot
狂人开飞机2 天前
15、音频系统
游戏引擎·godot
狂人开飞机2 天前
16、粒子线条与视觉特效
游戏引擎·godot
心前阳光3 天前
Unity发布PC软件图标不能改变
unity·游戏引擎
an86950013 天前
unity如何在visual studio中打断点debug
unity·游戏引擎·visual studio
xcLeigh3 天前
Unity基础:使用Transform控制物体移动——Translate与position详解
unity·游戏引擎
FairGuard手游加固3 天前
Unity小游戏加密:global-metadata.dat与AssetBundle保护
游戏·unity·游戏引擎