@@ -14,6 +14,13 @@ namespace HoloToolkit.Unity.InputModule
1414 /// </summary>
1515 public class InputManager : Singleton < InputManager >
1616 {
17+ /// <summary>
18+ /// To tap on a hologram even when not focused on,
19+ /// set OverrideFocusedObject to desired game object.
20+ /// If it's null, then focused object will be used.
21+ /// </summary>
22+ public GameObject OverrideFocusedObject { get ; set ; }
23+
1724 public event Action InputEnabled ;
1825 public event Action InputDisabled ;
1926
@@ -208,6 +215,9 @@ public void HandleEvent<T>(BaseEventData eventData, ExecuteEvents.EventFunction<
208215 return ;
209216 }
210217
218+ // Use focused object when OverrideFocusedObject is null.
219+ GameObject focusedObject = ( OverrideFocusedObject == null ) ? GazeManager . Instance . HitObject : OverrideFocusedObject ;
220+
211221 // Send the event to global listeners
212222 for ( int i = 0 ; i < globalListeners . Count ; i ++ )
213223 {
@@ -222,7 +232,6 @@ public void HandleEvent<T>(BaseEventData eventData, ExecuteEvents.EventFunction<
222232
223233 // If there is a focused object in the hierarchy of the modal handler, start the event
224234 // bubble there
225- GameObject focusedObject = GazeManager . Instance . HitObject ;
226235 if ( focusedObject != null && focusedObject . transform . IsChildOf ( modalInput . transform ) )
227236 {
228237
@@ -242,9 +251,9 @@ public void HandleEvent<T>(BaseEventData eventData, ExecuteEvents.EventFunction<
242251 }
243252
244253 // If event was not handled by modal, pass it on to the current focused object
245- if ( GazeManager . Instance . HitObject != null )
254+ if ( focusedObject != null )
246255 {
247- bool eventHandled = ExecuteEvents . ExecuteHierarchy ( GazeManager . Instance . HitObject , eventData , eventHandler ) ;
256+ bool eventHandled = ExecuteEvents . ExecuteHierarchy ( focusedObject , eventData , eventHandler ) ;
248257 if ( eventHandled )
249258 {
250259 return ;
0 commit comments