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

相关推荐
weixin_424294677 小时前
Unity 使用Steamworks.NET
unity·游戏引擎
ellis19707 小时前
Unity资源管理框架Addressables总结
unity·游戏引擎
yj爆裂鼓手7 小时前
unity编辑器下ab包模式下textMeshPro文本不显示材质是紫色的异常,真机无异常的问题
unity·编辑器·材质
郭逍遥8 小时前
[Godot] 通过AABB包围盒和射线法检测碰撞
算法·游戏引擎·godot
风痕天际8 小时前
Godot扫雷游戏制作记录4——计算周围地雷数并显示
游戏·游戏引擎·godot
EQ-雪梨蛋花汤9 小时前
【踩坑记录】使用 Layui 框架时解决 Unity WebGL 渲染在 Tab 切换时黑屏问题
unity·layui·webgl
风痕天际19 小时前
Godot扫雷游戏制作记录3——随机埋雷
游戏·游戏引擎·godot
淡海水2 天前
【节点】[EvaluateTipThickness节点]原理解析与实际应用
unity·游戏引擎·shadergraph·图形·evaluate·thickness
小贺儿开发2 天前
Unity3D 木胎雕刻
科技·unity·人机交互·互动·雕刻
HY小海2 天前
【Unity游戏创作】常见的设计模式
unity·设计模式·c#·游戏程序