# SendEvent(Event)

> Sends an Event to a window.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.7/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public bool SendEvent(Event e)
```

### Parameters

**** (\[Event]\(/engine/6000.7/script-reference/unityengine/event)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

The [EditorWindow.SendEvent](/engine/6000.7/script-reference/unityeditor/editorwindow/sendevent.md) public function passes a selected [Event](/engine/6000.7/script-reference/unityengine/event.md) to a chosen visible window. The [Event](/engine/6000.7/script-reference/unityengine/event.md) can be found in the [EventType](/engine/6000.7/script-reference/unityengine/eventtype.md) list.

In the following scripts `SendEventExample` looks up the `ReceiveEventExample` window. A `Paste` event is then sent over when the button is pressed.

### Examples

```csharp
// Send an event to another editor window. The second
// window needs to be visible to receive the event.

using UnityEngine;
using UnityEditor;
using UnityEngine.UIElements;

public class SendEventExample : EditorWindow
{
    [MenuItem("Examples/Send Event")]
    static void Init()
    {
        SendEventExample window =
            EditorWindow.GetWindow<SendEventExample>(true, "Send Event Window");
        window.Show();
    }

    void CreateGUI()
    {
        var buttonSendEvent = new Button();
        buttonSendEvent.text = "Send Event";
        buttonSendEvent.clicked += () =>
        {
            EditorWindow win = GetWindow<ReceiveEventExample>();
            if (win)
                using (var commandEvent = ExecuteCommandEvent.GetPooled(EditorGUIUtility.CommandEvent("Paste")))
                {
                    win.rootVisualElement.SendEvent(commandEvent);
                }
        };
        rootVisualElement.Add(buttonSendEvent);
    }
}
```

```csharp
// An Editor window that receives sent events.

using UnityEngine;
using UnityEditor;
using UnityEngine.UIElements;

public class ReceiveEventExample : EditorWindow
{
    [MenuItem("Examples/Receive Events")]
    static void Init()
    {
        ReceiveEventExample window =
            EditorWindow.GetWindow<ReceiveEventExample>(true, "Receive Events Window");
        window.Show();
    }

    void CreateGUI()
    {
        var button = new Button();
        button.text = "Button";
        rootVisualElement.Add(button);

        rootVisualElement.RegisterCallback<ExecuteCommandEvent>(evt =>
        {
            if (evt.commandName == "Paste")
                button.text = "Paste received";
        }, TrickleDown.TrickleDown);
    }
}
```
