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

相关推荐
呆呆敲代码的小Y2 小时前
【Unity工具篇】| 使用YooAsset接入自己的游戏项目,实现完整热更新流程
游戏·unity·游戏引擎·热更新·yooasset·资源热更新
张老师带你学2 小时前
Unity 低多边形 赛博朋克城市 拼装 模型 道路 建筑 buildin
科技·游戏·unity·游戏引擎·模型
PassionY2 小时前
Unity NGO 系列教程(四):多人抓取的权限争夺
unity·xr·network·ngo·multiplayer·ownership·多人竞态权
ฅ^•ﻌ•^ฅ12 小时前
Unity mcp并使用claude code制作游戏
游戏·unity·游戏引擎
程序员正茂2 小时前
Unity3d使用SRDebugger屏幕输出调试信息
unity·srdebugger
张老师带你学2 小时前
unity资源 buildin 低多边形 小镇村
科技·游戏·unity·游戏引擎·模型
PassionY2 小时前
Unity NGO 系列教程(五):如何构建多人联机区域触发系统
unity·rpc·ngo·网络触发器·serverrpc·networkvariable·authority
RReality3 小时前
【Unity UGUI】InputField 输入框全解
unity·游戏引擎
南無忘码至尊3 小时前
Unity学习90天-第3天-认识触屏输入(手游基础)并完成手机点击屏幕,物体向点击位置移动
学习·unity·c#·游戏引擎·游戏开发
南無忘码至尊3 小时前
Unity学习90天-第3天-认识C# 集合与常用类并实现生成随机位置的 10 个立方体
学习·unity·c#