Skip to content

Commit ceafcf5

Browse files
Fixed typo in method summary.
Updated GazeTransform assignment from Awake to Start, moved it into its own method and check it during update.
1 parent 6166bd3 commit ceafcf5

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

Assets/HoloToolkit/Input/Scripts/Gaze/GazeManager.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public class GazeManager : Singleton<GazeManager>
9393
public PointerEventData UnityUIPointerEvent { get; private set; }
9494

9595
/// <summary>
96-
/// Cached results of racast results.
96+
/// Cached results of raycast results.
9797
/// </summary>
9898
private List<RaycastResult> raycastResultList = new List<RaycastResult>();
9999

@@ -106,26 +106,13 @@ protected override void Awake()
106106
{
107107
RaycastLayerMasks = new LayerMask[] { Physics.DefaultRaycastLayers };
108108
}
109-
}
110109

111-
private void Start()
112-
{
113-
if (GazeTransform == null)
114-
{
115-
if (Camera.main != null)
116-
{
117-
GazeTransform = Camera.main.transform;
118-
}
119-
else
120-
{
121-
Debug.LogError("Gaze Manager was not given a GazeTransform and no main camera exists to default to.");
122-
}
123-
}
110+
FindGazeTransform();
124111
}
125112

126113
private void Update()
127114
{
128-
if (GazeTransform == null)
115+
if (!FindGazeTransform())
129116
{
130117
return;
131118
}
@@ -149,6 +136,20 @@ private void Update()
149136
}
150137
}
151138

139+
private bool FindGazeTransform()
140+
{
141+
if (GazeTransform != null) { return true; }
142+
143+
if (Camera.main != null)
144+
{
145+
GazeTransform = Camera.main.transform;
146+
return true;
147+
}
148+
149+
Debug.LogError("Gaze Manager was not given a GazeTransform and no main camera exists to default to.");
150+
return false;
151+
}
152+
152153
/// <summary>
153154
/// Updates the current gaze information, so that the gaze origin and normal are accurate.
154155
/// </summary>

0 commit comments

Comments
 (0)