Skip to content

Commit 92384c5

Browse files
author
Regis WANG
committed
fixed:
if cursor got disabled and enabled later at another surface, state may not appear correctly as the common sense. this is because target get set to null when disabled but not recover/update at enable.
1 parent 672ae97 commit 92384c5

File tree

1 file changed

+10
-1
lines changed
  • Assets/HoloToolkit/Input/Scripts/Cursor

1 file changed

+10
-1
lines changed

Assets/HoloToolkit/Input/Scripts/Cursor/Cursor.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,14 @@ private void Update()
180180
/// <summary>
181181
/// Override for enable functions
182182
/// </summary>
183-
protected virtual void OnEnable() { }
183+
protected virtual void OnEnable()
184+
{
185+
if (gazeManager)
186+
{
187+
OnFocusedObjectChanged(null, gazeManager.HitObject);
188+
}
189+
OnCursorStateChange(CursorStateEnum.None);
190+
}
184191

185192
/// <summary>
186193
/// Override for disable functions
@@ -190,6 +197,8 @@ protected virtual void OnDisable()
190197
TargetedObject = null;
191198
TargetedCursorModifier = null;
192199
visibleHandsCount = 0;
200+
IsHandVisible = false;
201+
OnCursorStateChange(CursorStateEnum.Contextual);
193202
}
194203

195204
private void OnDestroy()

0 commit comments

Comments
 (0)