Jump to content
Unity Insider Forum

Rangliste

Beliebte Inhalte

Showing content with the highest reputation on 02.01.2019 in Beiträge

  1. Hier mein Script zur Anzeige der FPS. Einfach der Szene hinzufügen (vorzugsweise auf ein Text Ui) und eine Referenz eines beliebigen Text Ui hinzufügen. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; /// <summary> /// This script calculate the current fps and show it to a text ui. /// </summary> public class UiDisplayFps : MonoBehaviour { public string formatedString = "{value} FPS"; public Text txtFps; public float updateRateSeconds = 4.0F; int frameCount = 0; float dt = 0.0F; float fps = 0.0F; void Update() { frameCount++; dt += Time.unscaledDeltaTime; if (dt > 1.0 / updateRateSeconds) { fps = frameCount / dt; frameCount = 0; dt -= 1.0F / updateRateSeconds; } txtFps.text = formatedString.Replace("{value}", System.Math.Round(fps, 1).ToString("0.0")); } }
    1 point

Ankündigungen

Hy, wir programmieren für dich Apps(Android & iOS):

Weiterleitung zum Entwickler "daubit"



×
×
  • Neu erstellen...