-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add simple FPS Counter #18
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,11 @@ public enum CubeTypes { | |
} | ||
|
||
public class CubeType : MonoBehaviour { | ||
private Rigidbody _rb; | ||
public CubeTypes type; | ||
|
||
void Awake() { | ||
_rb = GetComponent<Rigidbody>(); | ||
_rb.interpolation = RigidbodyInterpolation.Interpolate; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now I'd revert those changes just because using this rigidbody's interpolation type is even worse in our case. It's fully clipping through everything. I created an issue for this #19 and will be worked on later, because it's a bit more complicated problem. |
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using UnityEngine; | ||
using TMPro; | ||
public class FpsUI : MonoBehaviour { | ||
public TextMeshProUGUI fpsCounterText; | ||
float fpsCounter; | ||
float refreshTime = 0.5f; | ||
void Update() { | ||
fpsCounter = (int)(1f / Time.unscaledDeltaTime); | ||
if (Time.time > refreshTime) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we can put this calculation into this condition so we don't lose this 1 CPU cycle :P |
||
fpsCounterText.text = fpsCounter.ToString(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simply add |
||
refreshTime += 0.5f; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this |
||
} | ||
|
||
|
||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First things first
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fpsCounterText
ofFpsUI
is not assigned so we get a NullReferenceException.