# How to add a viewport to custom editor window?

**URL:** <https://forums.unrealengine.com/t/how-to-add-a-viewport-to-custom-editor-window/416454>\
**Category:** Platform & Builds\
**Tags:** window, viewport, unreal-engine, editor, Plugins, CPP, question\
**Created:** [February 5, 2018, 8:43am UTC](https://forums.unrealengine.com/t/how-to-add-a-viewport-to-custom-editor-window/416454 "2018-02-05T08:43:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Ali\_Akbar](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ali_akbar/32/1008648_2.png) [@Ali\_Akbar](https://forums.unrealengine.com/u/Ali_Akbar)\
**Post date:** [February 5, 2018, 9:04am UTC](https://forums.unrealengine.com/t/how-to-add-a-viewport-to-custom-editor-window/416454/2 "2018-02-05T09:04:36Z")

</div>

You’ll need two classes derived from these:

- **SEditorViewport** - A slate widget to host your viewport client
- **FEditorViewportClient** - A viewport client to handle the input and rendering

* * *

Since you already have an editor window, you probably have tabs already in place.  
Slate widgets would go in these tabs, one of which would be your 3D viewport.  
So, you’ll need to first create a slate widget for your 3D viewport by deriving from **SEditorViewport**

Override the SEditorViewport::MakeEditorViewportClient() function and provide your own “ViewportClient” implementation. You do this by subclassing from **FEditorViewportClient**

There is also a class called **FPreviewScene**. You can create this in the SEditorViewport::Construct function.  
This is an easy way to manage the actors in your preview scene (it will have its own world)

Search **SEditorViewport** and **FEditorViewportClient** in the engine’s code from github for examples  
[https://github.com/EpicGames/UnrealEngine](https://github.com/EpicGames/UnrealEngine)

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-add-a-viewport-to-custom-editor-window/416454)._
