# UGameViewportSubsystem Not Drawing Widgets

**URL:** <https://forums.unrealengine.com/t/ugameviewportsubsystem-not-drawing-widgets/752419>\
**Category:** UI\
**Tags:** unreal-engine, bug-report, Widget, CPP, Blueprint, UMG\
**Created:** [January 18, 2023, 11:49pm UTC](https://forums.unrealengine.com/t/ugameviewportsubsystem-not-drawing-widgets/752419 "2023-01-18T23:49:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakerieger](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jakerieger/32/572301_2.png) [@jakerieger](https://forums.unrealengine.com/u/jakerieger)\
**Post date:** [January 18, 2023, 11:49pm UTC](https://forums.unrealengine.com/t/ugameviewportsubsystem-not-drawing-widgets/752419/1 "2023-01-18T23:49:00Z")

</div>

So I recently updated to 5.1 and have since noticed lots of issues with the UI system. It appears to revolve around this new class `UGameViewportSubsystem`. For one, `AddToViewport` just doesn’t seem to work. The widget instance will be created and code inside the widget will run, but it simply won’t render to the screen. Here’s an example of the code I’m using to create and draw the widgets:

```cpp
UUserWidget* WidgetInstance = CreateWidget<UUserWidget>(GetWorld(), WidgetClass);
if (WidgetInstance) WidgetInstance->AddToViewport(0);

```

This does **not** work in 5.1 despite working just fine in 5.0 and older.

I found [this thread](https://forums.unrealengine.com/t/add-to-viewport-does-not-work/717453) on the same issue but the solution of calling `Super::Init()` on the GameInstance didn’t solve it for me as I was already doing this. Changing the GameInstance class to the engine default doesn’t help either.

Another thing I’ve noticed is that in the `UUserWidget::AddToViewport()` method, this line sometimes returns `null`

```cpp
UGameViewportSubsystem* Subsystem = UGameViewportSubsystem::Get(GetWorld()) // Subsystem == nullptr

```

It doesn’t help that the Unreal Doc’s entry for `UGameViewportSubsystem` is basically barren so I can’t really figure out exactly how this class operates without digging in to the source myself. Any ideas on fixes?
