Web UI with OrionBrowser
Draw the loading screen and the startup screens with HTML, CSS and JavaScript through the OrionBrowser plugin. Orion Loading Screen still decides when the screen shows, what the progress is and when startup ends; the page only draws the state it receives. The sample project is built exactly this way.
You need both plugins enabled, the OrionBrowser dependencies downloaded (the WebUIStudio button on the Level Editor toolbar, then Download) and the CommonUI viewport setup from the OrionBrowser installation guide. How to create and build a web app is in the OrionBrowser manual.
The page
The page is an ordinary OrionBrowser web app in Content/. It receives two events and sends three:
| Direction | Event | Payload |
|---|---|---|
| Unreal → page | ue:loadingScreen.state |
The JSON of Loading Screen State To Json, see the fields |
| Unreal → page | ue:loadingScreen.visibility |
{ "visible": true } or { "visible": false } |
| Page → Unreal | loadingScreen.ready |
{}: the page has loaded; Unreal sends the last state and visibility again |
| Page → Unreal | loadingScreen.presented |
{}: the page has drawn the first state after visible became true |
| Page → Unreal | loadingScreen.finishStartupScreen |
{}: ends a Custom startup screen, for example when a logo film has played |
Draw by kind:
kind |
What to draw |
|---|---|
custom |
Your own startup screen, such as a logo film. Send loadingScreen.finishStartupScreen when it ends. |
shaderCompilation |
progress, and shaderPrecompilesCompleted / shaderPrecompilesTotal to show the real count. |
pressAnyKey |
A loading state until waitingForInput becomes true, then the prompt. The plugin reads the key itself. |
loading |
The loading screen. variant, route and content carry the presentation of this loading; stage and status the current work. |
When handingOff becomes true the destination already renders behind the screen, which now fades out over Fade Out Seconds: play the exit animation of the page then.
Four things to keep in mind:
- Keep the page opaque. The loading screen hides the world until it is ready.
- Messages posted before the page starts loading can be dropped, for example on a first start while the browser is still initializing. Send
loadingScreen.readyonce the page listens, and let the widget answer with the last state and visibility. - Read a looping local video into a Blob before playing it: the local resource service does not answer Range requests, so a direct address cannot loop or seek.
- A synchronous map load blocks the game thread; the page keeps its last frame until the load ends. Everything after it, including your own loading tasks, animates normally.
The widget
-
Create an
OrionWebUIAppDefinitiondata asset for the app, with App Id set to the folder name and Use Dev Server in Editor cleared. -
Create a Widget Blueprint whose parent class is Orion Loading Screen Widget. In Designer, put an Image that fills the widget, in the background colour of the page, and on top of it an Orion WebUI named
WebUIwith Is Variable enabled and App Definition set to your data asset. The image covers the world until the page has drawn its first frame. -
In the graph:
- Add two String variables,
StateJsonandVisibilityJson; giveVisibilityJsonthe default{"visible":false}. - Event On Loading Screen State Changed → Loading Screen State To Json → Set StateJson → Post Retained Latest Event to Web on
WebUI, with Event Nameue:loadingScreen.stateandStateJsonas Payload Json. - Event On Loading Screen Shown → Hold Presentation → Set VisibilityJson to
{"visible":true}→ Post Retained Latest Event to Web with Event Nameue:loadingScreen.visibilityand that JSON. Event On Loading Screen Hidden → Set VisibilityJson to{"visible":false}→ the same post. - On Web Event of
WebUI→ Switch on Name with three pins:loadingScreen.finishStartupScreen→ Finish Startup Screen,loadingScreen.presented→ Release Presentation, andloadingScreen.ready→ whenStateJsonis not empty, post it asue:loadingScreen.state, then postVisibilityJsonasue:loadingScreen.visibility. Leave every other event on the Default pin.
Hold Presentation keeps Wait For Loading Screen waiting until the page has drawn, so a synchronous map load freezes a finished frame of the page.
- Add two String variables,
-
In Project Settings > Plugins > Orion Loading Screen, select the widget as Loading Screen Widget and as the Widget of each startup screen, and set Fade Out Seconds to the length of the page's exit animation.
The presenter keeps the widget for the whole game instance, so the browser loads once and every later loading appears at once.
A picture per destination
Call Begin Loading Operation with Destination set to the map, Travel enabled and an id the page knows in the Variant of Presentation, then Wait For Loading Screen, and call Open Level from both its Ready and Failed pins. The page receives it in lower case as variant and picks the picture, the title and the tips of that destination. The sample uses the map name as the id.
Packaging
Package as usual. OrionBrowser stages the app's dist folder and its Helper; Orion Loading Screen needs nothing extra.