Skip to content

Commit

Permalink
FPS UI and Cube Physics fix ezioleq#2
Browse files Browse the repository at this point in the history
  • Loading branch information
ejcila committed Oct 15, 2021
1 parent 81d35d9 commit 821ce75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
5 changes: 0 additions & 5 deletions Assets/Scripts/CubeType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ public enum CubeTypes {
}

public class CubeType : MonoBehaviour {
private Rigidbody _rb;
public CubeTypes type;

void Awake() {
_rb = GetComponent<Rigidbody>();
_rb.interpolation = RigidbodyInterpolation.Interpolate;
}
}
18 changes: 9 additions & 9 deletions Assets/Scripts/UI/FpsUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
using TMPro;
public class FpsUI : MonoBehaviour {
public TextMeshProUGUI fpsCounterText;
float fpsCounter;
float refreshTime = 0.5f;
[SerializeField] private float fpsRefreshRate = 0.5f; // defines how often fps will be updated on HUD ;
private float fpsCounter;
private float timer;

void Update() {
fpsCounter = (int)(1f / Time.unscaledDeltaTime);
if (Time.time > refreshTime) {
fpsCounterText.text = fpsCounter.ToString();
refreshTime += 0.5f;
if (Time.time > timer) {
fpsCounter = (int) (1f / Time.unscaledDeltaTime);
fpsCounterText.text = fpsCounter.ToString() + " FPS";
timer += fpsRefreshRate;
}


}
}
}

0 comments on commit 821ce75

Please sign in to comment.