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

相关推荐
avi91112 小时前
Unity 天命6源码- 商业游戏说明分析
开发语言·unity·c#·游戏开发·游戏源码
世洋Blog3 小时前
Unity脚本生命周期(全)
unity·游戏引擎
DowneyJoy5 小时前
【多媒体交互】透明无边框窗口
unity·c#·.net·交互
CreasyChan5 小时前
Unity GC实战优化总结
unity·c#
Howrun7779 小时前
虚幻引擎_AController_APlayerController_AAIController
开发语言·c++·游戏引擎·虚幻
习惯就好zz10 小时前
Godot Player CharacterBody2D 移动和停止配置
游戏引擎·godot·characterbody2d·animationplayer·animationtree
ysn1111111 小时前
Unity合批实战
unity·游戏引擎
Howrun77712 小时前
虚幻引擎_玩家控制器APlayerController(进阶)
游戏引擎·虚幻
IMPYLH12 小时前
Lua 的 Package 模块
java·开发语言·笔记·后端·junit·游戏引擎·lua
警醒与鞭策12 小时前
大模型对比
unity·性能优化·c#·游戏引擎·cursor