Skip to content
SiteEmail

cohtml.DefaultResourceHandler

A default implementation of the cohtml.Net.IResourceHandler interface. Responsible for intercepting and handling all asynchronous resource loading requests (images, fonts, HTML, CSS, JS) made by the Cohtml UI. Resources can be loaded from three types of locations * Relative To Local Mapping (Recommended) - Paths using the coui protocol, which are resolved against the HostLocationsMap (default inside the StreamingAssets/Cohtml folder). * Absolute paths - Direct file system paths Using absolute paths is generally considered bad practice as it breaks cross-platform build compatibility. * Web - Remote assets fetched via standard HTTP/HTTPS using UnityWebRequest.

Inherits from cohtml.Net.ResourceHandler, cohtml.ISystemStorable, cohtml.ILocationsSearchable, SystemIDisposable

Name
DefaultResourceHandler()
Initializes a default host location path and adds it to a host location collection the user can access from this resource handler object.
override voidOnResourceRequest(IResourceRequest request, IResourceResponse response)
Invoked when Cohtml makes a resource request.
virtual override voidOnAbortResourceRequest(uint id)
Invoked when Cohtml aborts a resource request.
virtual override voidDispose()
Stops all resource loading coroutines and aborts all pending requests.
Name
IDictionary< string, List< string > >HostLocationsMap
Provide additional locations to be searched for resources inside the project. That functionality comes in handy when you want to store resources inside other locations within the project.
Name
const stringCoui
const stringCouiProtocol
const stringUIResourcesPath
const stringPreloadedHost
const stringCohtml
const stringSharedImagesPath
const stringUIResourcesHost
intPendingRequestsCount
Returns the number of pending requests.
KeyValuePair< string, List< string > >DefaultHostLocations
Returns the default host locations for this resource handler.

Public Functions inherited from cohtml.Net.ResourceHandler

Name
delegate voidSwigDelegateResourceHandler_0(global.System.IntPtr request, global.System.IntPtr response, global.System.IntPtr swigId)
delegate voidSwigDelegateResourceHandler_1(uint id, global.System.IntPtr swigId)

Protected Functions inherited from cohtml.Net.ResourceHandler

Name
ResourceHandler()

Protected Attributes inherited from cohtml.Net.ResourceHandler

Name
boolswigCMemOwn
DefaultResourceHandler()

Initializes a default host location path and adds it to a host location collection the user can access from this resource handler object.

override void OnResourceRequest(
IResourceRequest request,
IResourceResponse response
)

Invoked when Cohtml makes a resource request.

virtual override void OnAbortResourceRequest(
uint id
)

Invoked when Cohtml aborts a resource request.

Reimplements: cohtml.Net.ResourceHandler.OnAbortResourceRequest

virtual override void Dispose()

Stops all resource loading coroutines and aborts all pending requests.

Reimplements: cohtml.Net.ResourceHandler.Dispose

IDictionary< string, List< string > > HostLocationsMap;

Provide additional locations to be searched for resources inside the project. That functionality comes in handy when you want to store resources inside other locations within the project.

const string Coui = "coui";
const string CouiProtocol = Coui + "://";
const string UIResourcesPath = Cohtml + "UIResources";
const string PreloadedHost = "preloaded";
const string Cohtml = "Cohtml/";
const string SharedImagesPath = Cohtml + "SharedImages";
const string UIResourcesHost = "uiresources";
int PendingRequestsCount => m_PendingRequests.Count;

Returns the number of pending requests.

static KeyValuePair< string, List< string > > DefaultHostLocations => s_DefaultHostLocations;

Returns the default host locations for this resource handler.