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

相关推荐
玖玥拾2 小时前
Lua 基础语法(五)Unity xLua基础配置与 C# 访问 Lua
开发语言·unity·c#·lua
玖玥拾20 小时前
Lua 基础语法(二)
开发语言·unity·lua
点心的游戏开发世界1 天前
GDScript 入门笔记(十六):文件读写与数据持久化
开发语言·笔记·游戏引擎·godot
点心的游戏开发世界1 天前
GDScript 入门笔记(十三):字符串操作
开发语言·笔记·游戏引擎·godot
点心的游戏开发世界1 天前
GDScript 入门笔记(十二):类型系统进阶
笔记·游戏引擎·godot
玖玥拾1 天前
Lua 基础语法(三) 元表 metatable、元方法、模拟面向对象
开发语言·unity·lua
点心的游戏开发世界1 天前
GDScript 入门笔记(十一):Lambda 与匿名函数
开发语言·笔记·游戏引擎·godot
公爵爱学习2 天前
无人机多点巡航
游戏引擎·无人机·cocos2d
公爵爱学习2 天前
关于无人机定点飞行的一些解释和Matlab程序绘制
游戏引擎·无人机·cocos2d
wgslucky3 天前
Godot GDScript初学者遇到的问题记录
游戏引擎·godot