Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
LSK_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
You need to sign in or sign up before continuing.
Authored by
이상윤
2020-05-31 15:13:25 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
05b8a0e9624046b4eaa15bf352ed04c7ccbd1bda
05b8a0e9
1 parent
bb5dd299
FPS Check
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
sourcecode/capstone/Assets/Script/FPS_Check.cs
sourcecode/capstone/Assets/Script/FPS_Check.cs
0 → 100644
View file @
05b8a0e
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
FPS_Check
:
MonoBehaviour
{
[
Range
(
1
,
100
)]
public
int
fFont_Size
;
[
Range
(
0
,
1
)]
public
float
Red
,
Green
,
Blue
;
float
deltaTime
=
0.0f
;
private
void
Start
()
{
fFont_Size
=
fFont_Size
==
0
?
50
:
fFont_Size
;
}
void
Update
()
{
deltaTime
+=
(
Time
.
unscaledDeltaTime
-
deltaTime
)
*
0.1f
;
}
void
OnGUI
()
{
int
w
=
Screen
.
width
,
h
=
Screen
.
height
;
GUIStyle
style
=
new
GUIStyle
();
Rect
rect
=
new
Rect
(
0
,
0
,
w
,
h
*
2
/
100
);
style
.
alignment
=
TextAnchor
.
UpperLeft
;
style
.
fontSize
=
h
*
2
/
fFont_Size
;
style
.
normal
.
textColor
=
new
Color
(
Red
,
Green
,
Blue
,
1.0f
);
float
msec
=
deltaTime
*
1000.0f
;
float
fps
=
1.0f
/
deltaTime
;
string
text
=
string
.
Format
(
"{0:0.0} ms ({1:0.} fps)"
,
msec
,
fps
);
GUI
.
Label
(
rect
,
text
,
style
);
}
}
\ No newline at end of file
Please
register
or
login
to post a comment