# OnFocus()

> Called when the window gets keyboard focus.

## Definition

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

```csharp
public void OnFocus()
```

### Remarks

Additional Resources: OnLostFocus. ![OrthographicPreviewer (OnFocus())](/api/media?file=/engine/6000.7/media/images/OrthographicPreviewer.png) *Preview your camera in orthographic mode when you select the window.*

### Examples

```csharp

{code Modules/UIElements/Tests/UIElementsExamples/Assets/EditorWindowCodeExamples/OrthographicPreview.cs}
```
