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
Public Functions
Section titled “Public Functions”| 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 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. |
| virtual override void | Dispose() Stops all resource loading coroutines and aborts all pending requests. |
Public Properties
Section titled “Public Properties”| 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. |
Public Attributes
Section titled “Public Attributes”| Name | |
|---|---|
| const string | Coui |
| const string | CouiProtocol |
| const string | UIResourcesPath |
| const string | PreloadedHost |
| const string | Cohtml |
| const string | SharedImagesPath |
| const string | UIResourcesHost |
| int | PendingRequestsCount Returns the number of pending requests. |
| KeyValuePair< string, List< string > > | DefaultHostLocations Returns the default host locations for this resource handler. |
Additional inherited members
Section titled “Additional inherited members”Public Functions inherited from cohtml.Net.ResourceHandler
| Name | |
|---|---|
| delegate void | SwigDelegateResourceHandler_0(global.System.IntPtr request, global.System.IntPtr response, global.System.IntPtr swigId) |
| delegate void | SwigDelegateResourceHandler_1(uint id, global.System.IntPtr swigId) |
Protected Functions inherited from cohtml.Net.ResourceHandler
| Name | |
|---|---|
| ResourceHandler() |
Protected Attributes inherited from cohtml.Net.ResourceHandler
| Name | |
|---|---|
| bool | swigCMemOwn |
Public Functions Documentation
Section titled “Public Functions Documentation”function DefaultResourceHandler
Section titled “function DefaultResourceHandler”DefaultResourceHandler()Initializes a default host location path and adds it to a host location collection the user can access from this resource handler object.
function OnResourceRequest
Section titled “function OnResourceRequest”override void OnResourceRequest( IResourceRequest request, IResourceResponse response)Invoked when Cohtml makes a resource request.
function OnAbortResourceRequest
Section titled “function OnAbortResourceRequest”virtual override void OnAbortResourceRequest( uint id)Invoked when Cohtml aborts a resource request.
Reimplements: cohtml.Net.ResourceHandler.OnAbortResourceRequest
function Dispose
Section titled “function Dispose”virtual override void Dispose()Stops all resource loading coroutines and aborts all pending requests.
Reimplements: cohtml.Net.ResourceHandler.Dispose
Public Property Documentation
Section titled “Public Property Documentation”property HostLocationsMap
Section titled “property HostLocationsMap”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.
Public Attributes Documentation
Section titled “Public Attributes Documentation”variable Coui
Section titled “variable Coui”const string Coui = "coui";variable CouiProtocol
Section titled “variable CouiProtocol”const string CouiProtocol = Coui + "://";variable UIResourcesPath
Section titled “variable UIResourcesPath”const string UIResourcesPath = Cohtml + "UIResources";variable PreloadedHost
Section titled “variable PreloadedHost”const string PreloadedHost = "preloaded";variable Cohtml
Section titled “variable Cohtml”const string Cohtml = "Cohtml/";variable SharedImagesPath
Section titled “variable SharedImagesPath”const string SharedImagesPath = Cohtml + "SharedImages";variable UIResourcesHost
Section titled “variable UIResourcesHost”const string UIResourcesHost = "uiresources";variable PendingRequestsCount
Section titled “variable PendingRequestsCount”int PendingRequestsCount => m_PendingRequests.Count;Returns the number of pending requests.
variable DefaultHostLocations
Section titled “variable DefaultHostLocations”static KeyValuePair< string, List< string > > DefaultHostLocations => s_DefaultHostLocations;Returns the default host locations for this resource handler.
© 2026 Coherent Labs. All rights reserved.