# IGvrEventExecutor Interface Reference

# IGvrEventExecutor

Provides an interface for executing events for `IEventSystemHandler`.

## Summary

### Inheritance

Direct Known Subclasses:[GvrEventExecutor](https://developers.google.com/vr/reference/unity/class/GvrEventExecutor)

| ### Public functions ||
|---|---|
| `https://developers.google.com/vr/reference/unity/interface/IGvrEventExecutor#interfaceIGvrEventExecutor_1a06bac02a4be64828c08491307a0f434c(GameObject target, BaseEventData eventData, ExecuteEvents.EventFunction< T > functor)` | `bool` Execute the event of type `T : IEventSystemHandler` on the game object. |
| `https://developers.google.com/vr/reference/unity/interface/IGvrEventExecutor#interfaceIGvrEventExecutor_1a0b53810698bfe307665277bfd0bd4c46(GameObject root, BaseEventData eventData, ExecuteEvents.EventFunction< T > callbackFunction)` | `GameObject` Recurse up the hierarchy calling `Execute` until there is a game object that can handle the event. |
| `https://developers.google.com/vr/reference/unity/interface/IGvrEventExecutor#interfaceIGvrEventExecutor_1a2557d6052f504e335a9c38f9e4e28d45(GameObject root)` | `GameObject` Traverse the object hierarchy starting at root, and return the game object which implements the event handler of type `T`. |

## Public functions

### Execute\< T \>

```c#
bool Execute< T >(
  GameObject target,
  BaseEventData eventData,
  ExecuteEvents.EventFunction< T > functor
)
```
Execute the event of type `T : IEventSystemHandler` on the game object.

The event will be executed on all components on the game object that can handle it.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `target` | Target game object. | | `eventData` | Data associated with the executing event. | | `functor` | Function to execute on the game object components. | |
| Template Parameters | |---|---| | `T` | An interface with methods for handling events. | |
| **Returns** | A value indicating whether the delegate successfully executed. |

### ExecuteHierarchy\< T \>

```c#
GameObject ExecuteHierarchy< T >(
  GameObject root,
  BaseEventData eventData,
  ExecuteEvents.EventFunction< T > callbackFunction
)
```
Recurse up the hierarchy calling `Execute` until there is a game object that can handle the event.

See <https://docs.unity3d.com/2017.4/Documentation/ScriptReference/EventSystems.ExecuteEvents.ExecuteHierarchy.html>.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `root` | Start game object for search. | | `eventData` | Data associated with the executing event. | | `callbackFunction` | Function to execute on the game object components. | |
| Template Parameters | |---|---| | `T` | An interface with methods for handling events. | |
| **Returns** | GameObject Game object that handled the event. |

### GetEventHandler\< T \>

```c#
GameObject GetEventHandler< T >(
  GameObject root
)
```
Traverse the object hierarchy starting at root, and return the game object which implements the event handler of type `T`.

**Note:**Traversal is performed upwards from the target object, not down.

| Details ||
|---|---|
| Parameters | |---|---| | `root` | The root object to which to send event triggers. | |
| Template Parameters | |---|---| | `T` | An interface with methods for handling events. | |
| **Returns** | The event handler. |