Neo Async Loading ScreenDocsNeo Settings
CustomizeYour Own Screen

Your Own Screen

When the style is not enough, bring your own loading screen: a native Slate view in C++, or a UMG widget made in the designer.

On this page
  1. A UMG loading screen
  2. A native Slate view
  3. Choosing, in short

Neo Async Loading Screen draws its own loading screen, styled by the recipe, in a game on its own thread on Direct3D 12, Windows 64-bit, while the engine loads. The two ways to bring yours differ in one thing that matters a lot: what happens while the game thread is blocked, which is most of a map load.

Native Slate viewUMG widget
Recipescreen { widget native MyStudioView }screen { widget "/Game/UI/WBP_Loading" } and engine { thread off }
Made inC++ (a Slate widget)the UMG designer (a Widget Blueprint)
While the game thread is blocked (LoadMap, a long spawn)painted by Neo Async Loading Screen's own thread, on Direct3D 12 (not with texts in Arabic, Hebrew, Thai or a script of India: HLP406)frozen: nothing paints it until the game thread is back
Unitsthe look's unit: 1 unit = 1 pixel at 1080p, at every resolutionUMG's own (your project's DPI curve)
Fades, floor, mouseyours to paintdone for you (the style's fades and opaque floor, the mouse stopped)
Rulesthe native view contract belowUMG's own, and the few lines below

Pick a native view when the screen must go on drawing while the engine loads. Pick UMG when your team designs in UMG and a frozen frame during the heaviest part of a load is acceptable: it is the price of UMG, not a defect. The default view of the plugin is a native view.

A UMG loading screen

  1. Create a Widget Blueprint whose parent class is Neo Async Loading Screen User Widget (UNeoLoadingScreenUserWidget).
  2. Read the screen with its functions, in bindings or in the graph: Get Level Name, Get Tip, Get Status, Get Image Brush and Has Image, Get Elapsed Seconds, Get Kind, Get Loading Phase, Get Progress (negative when the game reports none; the plugin itself never shows a progress). Two events: On Loading Started (the widget was just made for a screen) and On Loading Finishing (the screen begins to fade out, or ends without a fade).
  3. Or name widgets of the designer LevelNameText, TipText, StatusText (Text Blocks) and BackdropImage (an Image): they are filled every frame, nothing to bind. For the image with its style's life (its slow drift, the style's vignette, grain, glows and slow motion, as the plugin's own screen draws it: Recipes, Bringing the image to life), add a Neo Async Loading Screen Backdrop (UNeoLoadingScreenBackdrop) named Backdrop instead of the Image. It draws no plate under your texts, and its Render Opacity dims it.
  4. Choose it in a recipe (Config/NeoLoadingScreen/*.hload or a recipe asset):
Recipe
hload 1
screen {
  widget "/Game/UI/WBP_Loading"
}
engine {
  thread off
}

Without engine { thread off } the recipe is refused (HL431) and the default view is shown: a UMG widget draws on the game thread only, and the screen's own thread never shows one.

The plugin ships a sample made by script, /NeoLoadingScreen/Samples/WBP_NeoLoadingScreenSample (the Backdrop and the three texts over a full-screen overlay, and a throbber the game thread animates): point a recipe at it to try UMG, or duplicate it.

Scroll the graph sideways.

A UMG screen's two events: the heading takes Get Level Name in On Loading Started, and the throbber is hidden in On Loading Finishing.

Cooking. Nothing in your maps references the widget: the editor module adds to the cook every asset a recipe of the project names (Project Settings, Config/NeoLoadingScreen/*.hload, the recipe assets), the widget included. A widget named only by a recipe made at run time is not cooked: reference it from something cooked (a Primary Asset, a map, your game instance), or add its folder to Project Settings > Packaging > Additional Asset Directories to Cook.

The very first screen. The plugin loads the widget's class in advance and asynchronously, as soon as the recipe names it, when the game instance starts (before the engine's first map load); nothing is ever loaded synchronously when a screen shows. The first map load of the launch begins right after, so its screen nearly always comes before the class is loaded, and shows the default view (HLP480), in your style. If that screen must be yours too, have the class in memory before the game instance starts: a hard reference from your Game Instance class (the engine loads that class, and what it references, before anything else of the game), never a reference from the startup map (the map is loaded after its screen is made).

What the plugin does for a UMG screen:

  • it makes one widget per screen, on the game instance, in the game layer above every other widget of the game;
  • it paints the style's opaque floor under the widget (the level never shows through), fades the whole in and out with the style's curves and the player's Reduce Motion, and stops the mouse while the screen covers the game;
  • On Loading Finishing comes when the fade out begins, or just before the widget goes when the screen ends without a fade (another system's screen took over). A new load during the fade cancels it: the screen covers again, with the same widget (Get Loading Phase is no longer Closing), and On Loading Finishing comes again when the screen really closes. Play your exit so that it can be undone;
  • On Loading Started, On Loading Finishing and the widget's Construct may call the plugin back (Show Loading Screen, Hide Loading Screen, Add or Remove Loading Screen Hold, Open Level Behind Loading Screen): the call is carried out once what the plugin was doing is over, before the call that ran your event returns. A screen shown from On Loading Finishing is a new screen of its own;
  • each screen without the presenter's thread says so in the log, with its cause: Neo Async Loading Screen: thread off umg widget /Game/UI/WBP_Loading: the game thread draws this screen (engine { thread off }).

When the widget cannot be shown, the default view is, and the log says why, once per widget and reason (each code has its entry in Troubleshooting):

CodeCauseFix
HLP480the class is not loaded yetit loads in the background; for the first screen of the launch, see above
HLP481the class is not a usable Neo Async Loading Screen User Widget (another class, an abstract one)reparent the Widget Blueprint
HLP482the presenter's thread is on for this screenwrite engine { thread off }
HLP483not the path of a Widget Blueprintwrite widget "/Game/UI/WBP_Loading"
HLP485Create Widget gave nothingsee the lines before it in the log
HLP486the class could not be loaded: no such asset, or it was not cookedcheck the path; see Cooking above

A native Slate view

Register a factory from your module (its StartupModule), remove it at ShutdownModule. Your module's Build.cs names NeoLoadingScreen (and the engine's Slate, SlateCore), nothing else of the plugin:

C++
#include "NeoLoadingScreenViews.h"

FNeoLoadingScreenViews::SetViewFactory(TEXT("MyStudioView"), [](const FNeoLoadingScreenViewArgs& Args)
{
    return SNew(SMyStudioLoadingView, Args);
});

and choose it in a recipe with screen { widget native MyStudioView }.

The same factory makes the instance the game thread paints (the game layer) and the instance Neo Async Loading Screen's own thread paints while the game thread is blocked. Both get the same source, the same start and the same clock, and the plugin lays both out at the same scale: the look's unit, 1 unit = 1 pixel at 1080p (the style's Interface Size included), whatever the resolution and whatever the DPI curve of your project. Write your view in Slate units as usual: it fills 1920 x 1080 units on a 16:9 screen at any resolution, and both instances paint the same pixels at the same instant, so passing from one to the other changes nothing on screen.

The contract of a native view, which the plugin cannot check for you:

  • the factory runs on the game thread, once per presentation (each time the plugin's thread starts presenting a screen, and each time the game layer shows it), so one screen may make several instances: build everything there (fonts, brushes, sizes), and keep no state of your own across instances: what the view shows comes from the source and the clock, never from how long the instance has lived;
  • after that, the view reads no UObject, no game state and no engine global; only Args.Source (GetLook, GetState, safe from any thread), Args.StartSeconds and Args.Now();
  • OnPaint, Tick and layout are safe on another thread: never wait for the game thread, never take a lock it may hold, never rasterize new glyphs (shape your texts while the view is built);
  • time comes from Args.Now(), never from frame counts or the engine's delta time;
  • it is opaque: every pixel of its geometry, every frame (the level must never show through);
  • if it draws the status line (ComposeNeoLoadingScreenStatusLine(State, Now)), it says so in OnPaint: NoteNeoLoadingScreenStatusDrawn(Args.Source.ToSharedRef(), State.Engine.SerialAt(Now), Now). The line then keeps its pace on screen even when a frame comes late; without it, the pace counts from the moment each change is published;
  • it is destroyed on the game thread.

The launch screen (from the start of the process to the end of the first map's load) always shows the default view, in your style: the plugin's thread covers the launch before your module registers its view, and one screen keeps one look. Your view shows from the next screen on.

Without a factory under the recipe's name, the default view is shown and the log says so once (HLP484).

Choosing, in short

  • The screen must go on drawing while the engine loads (the reason this plugin exists): the default view with your style, or a native view.
  • Your screen is a UMG design and a frozen frame while the engine loads is fine: UMG, with engine { thread off }.
  • Never both on one screen: one look per screen, the same in every surface.

Something not as described? Every code the editor or the log shows has its own entry in Troubleshooting.