title: How to add widget in Unreal Engine
body: <p>How can I add widget to the screen in Unreal Engine?
  By some reason variable <code>blackLinesWidgetClass</code> is always null.</p>
  
  <pre><code>    FStringClassReference blackLinesWidgeClasstRef(TEXT("WidgetBlueprint'/Game/Blueprints/UI/blackLines.blackLines'"));
      UClass* blackLinesWidgetClass = blackLinesWidgeClasstRef.TryLoadClass&lt;UUserWidget&gt;();
      if (blackLinesWidgetClass)
      {
          UUserWidget* blackLinesWidget = CreateWidget&lt;UUserWidget&gt;(this-&gt;GetGameInstance(), blackLinesWidgetClass);
          if (blackLinesWidget)
              blackLinesWidget-&gt;AddToViewport();
      }
  </code></pre>