Base Rigidbody Movement + FPS counter

This commit is contained in:
DerTyp187
2021-09-29 18:47:21 +02:00
parent ed0c5cece6
commit 85f16b0697
12 changed files with 335 additions and 109 deletions

View File

@@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FPSCounter : MonoBehaviour
{
public TMPro.TextMeshProUGUI fpsText;
public float deltaTime;
void Start()
{
fpsText = gameObject.GetComponent<TMPro.TextMeshProUGUI>();
}
void Update()
{
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
float fps = 1.0f / deltaTime;
fpsText.text = Mathf.Ceil(fps).ToString() + "FPS";
}
}