Resource Host Locations

The host part of a URL is the part directly following the protocol, separated by double slash (//), i.e.

src = "coui://hostname/Some/Relative/Path";

Each host maps to a different physical location, allowing you flexible control over your resources. For example, in the following snippet, the hosts images and fonts can refer to different hard drive locations:

src = "coui://images/.../"
src = "coui://fonts/.../"

You can also set host locations dynamically in several ways, which allows you to map the same host to different physical locations, depending on external context, such as the type of build. Consider the following (pseudocode) example:

if (debug_build)
    uiresources_host = "my/debug/location"
else
    uiresources_host = "my/usual/location"

If both locations have the same directory structure, any relative URL path such as coui://uiresources_host/relative/path will be resolved to a different location.

How to use

You should first update the code in your HTML/CSS pages to use the host, as follows:

"coui://uiresources/Hello/Hello.html" becomes "coui://host/uiresources/Hello/Hello.html"
"url(images/image.png);" becomes "url(//host/images/image.png);"

For the rest, there are two main ways to setup the host->location mapping. You can do it statically through your Project Settings, or you can set them dynamically from your C++ code via delegate.

Host locations via Project Settings

You can set up your locations in your Editor by navigating to Prysm->Prysm Options->Resource Host Mapping

To ease portability, Prysm provides several predefined locations that you can use out of the box to construct paths, namely:

  • Engine - Root of the Engine folder
  • EnginePlugins - Root of the Engine Plugins folder
  • EngineContent - Root of the Engine Content folder
  • Game - Root of the Project folder
  • GamePlugins - Root of the Game-only plugins

When no such predefined location is provided, the locations you provide are assumed to be relative to the Game/Content/ folder.

Host locations via callback

You can dynamically set up the host locations via the OnGetResourceHostLocations delegate. This allows you to construct locations dynamically, for example depending on the type of build, predefined OS environment variables, or querying a server for information. The delegate will be called every time Prysm updates the resource locations internally, which is during the PreWorldInitialization event.