File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Assets/HoloToolkit/Utilities/Scripts Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 22// Licensed under the MIT License. See LICENSE in the project root for license information.
33
44using UnityEngine ;
5+ using UnityEngine . UI ;
56
67namespace HoloToolkit . Unity
78{
@@ -11,10 +12,14 @@ namespace HoloToolkit.Unity
1112 [ RequireComponent ( typeof ( TextMesh ) ) ]
1213 public class FpsDisplay : MonoBehaviour
1314 {
14- [ Tooltip ( "Reference to Text UI control where the FPS should be displayed." ) ]
15+ [ Tooltip ( "Reference to TextMesh component where the FPS should be displayed." ) ]
1516 [ SerializeField ]
1617 private TextMesh textMesh ;
1718
19+ [ Tooltip ( "Reference to uGUI text component where the FPS should be displayed." ) ]
20+ [ SerializeField ]
21+ private Text uGUIText ;
22+
1823 [ Tooltip ( "How many frames should we consider into our average calculation?" ) ]
1924 [ SerializeField ]
2025 private int frameRange = 60 ;
@@ -53,7 +58,15 @@ private void Update()
5358
5459 private void InitBuffer ( )
5560 {
56- textMesh = GetComponent < TextMesh > ( ) ;
61+ if ( textMesh == null )
62+ {
63+ textMesh = GetComponent < TextMesh > ( ) ;
64+ }
65+
66+ if ( uGUIText == null )
67+ {
68+ uGUIText = GetComponent < Text > ( ) ;
69+ }
5770
5871 if ( frameRange <= 0 )
5972 {
@@ -72,6 +85,11 @@ private void UpdateTextDisplay(int fps)
7285 {
7386 textMesh . text = displayString ;
7487 }
88+
89+ if ( uGUIText != null )
90+ {
91+ uGUIText . text = displayString ;
92+ }
7593 }
7694
7795 private void UpdateFrameBuffer ( )
You can’t perform that action at this time.
0 commit comments