v.0.1.1 Released
Physics Box » Devlog

- Fixed turbine blades rotation inconsistency.
- Added FPS stats to UI.
- Added video and cover image to the itch.io page.
- Added chains!
FPS is calculated in an Update function. It increases the frame count per function call and accumulates the elapsed time to see if it has been a second. If so, it updates the text to display the info. It is a super basic stat.
Here is the script to generate it:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class StatCalculator : MonoBehaviour
{
[SerializeField]
private Text StatText = null;
private int frameCount = 0;
private float timeElapsed = 0;
private int fpsToDisplay = 0;
private void Awake()
{
// If not assigned, try to get the text component attached.
if (StatText == null)
{
StatText = GetComponent<Text>();
}
Debug.Assert(StatText != null);
}
private void Update()
{
++frameCount;
timeElapsed += Time.deltaTime;
// One second passed.
if (timeElapsed >= 1.0f)
{
timeElapsed = 0.0f;
fpsToDisplay = frameCount;
frameCount = 0;
UpdateStatText();
}
}
private void UpdateStatText()
{
StatText.text = "FPS: " + fpsToDisplay;
}
}
You can access all the files from the git repo.
Files
PhysicsBox_v_0_1_1.zip 8 MB
Aug 31, 2020
Get Physics Box
Physics Box
A Small Playing Box With Interactive Physics Objects
| Status | In development |
| Author | Kenan Maraşlı |
| Genre | Simulation |
| Tags | Physics, Unity |
More posts
- v.0.1.2 ReleasedSep 01, 2020
- v.0.1.0 ReleasedAug 25, 2020
Leave a comment
Log in with itch.io to leave a comment.