Library Configuration

Overview

The library creates Systems, initializes rendering, executes tasks, and manages memory and performance. There is only one instance for the Unity3D editor lifetime. You can configure some of the Library behavior.

How To Use

  1. From Unity3D’s Context menu, click on the Prysm/Configure Library menu. The Library configuration window will appear.
  2. Change the parameters with your preferences and click the Save button.
  3. Restart the Unity3D Editor to apply your Library configuration.

Library Parameters

Logging Severity

cohtml.Net.LibraryParamsWithExternalRenderingLibrary.LoggingSeverity of the logging messages to show. Keep this to Info or higher in Shipping builds. Excessive logging can hurt performance.

Use Dedicated Layout Thread

cohtml.Net.LibraryParamsWithExternalRenderingLibrary.UseDedicatedLayoutThread controls whether the application will spawn a dedicated layout thread or the Layout will happen in the game thread, during the cohtml.Net.View.Advance method Doing Layout on a separate thread is recommended as it improves scalability and reduces time spent in the Main DOM thread. For more information please refer to Rendering Architecture.

Use C# Rendering Backend

When this option is enabled the plugin will use Unity’s C# rendering API, instead of the native rendering library provided by Prysm. It also ensures that rendering commands recording is on the Main thread. This option is not a Library setting, so you don’t have to restart the editor when you enable/disable it between play/stops. The two backends are supported on the following platforms:

PlatformNative rendering backendC# Rendering backend
WindowsYesYes
MacOSYesYes
iOSYesNo
AndroidYesPartially (Vulkan only)
PS4YesYes
Xbox OneYesYes
PS5YesYes
Xbox Series X/SYesYes
SwitchNoYes

Default Style Font Family

cohtml.Net.LibraryParamsWithExternalRenderingLibrary.DefaultStyleFontFamily sets the default font family that will be used by all Elements in the Views. The default font style is analogous to setting the CSS property “font-family” of all elements to the value of this field.

Path tessellation threshold ratio

cohtml.Net.CommonRenderingLibraryParams.PathTessellationThresholdRatio sets the threshold ratio, which is used for determining whether to reuse old tessellated paths or tessellate new ones when changing the display size of paths (e.g. SVGs). If the threshold ratio is lower, then more paths will be tessellated, which will lead to a higher path visual quality but also increased memory usage. On the other hand, setting the threshold ratio to a higher value will result in the reuse of more tessellated paths, which may cause lower path visual quality, because old tessellated paths are upscaled or downscaled to be reused. However, a higher threshold value will lead to a decrease in memory usage. Tessellation threshold ratio less than or equal to 1 will cause tessellation on every size change.

Allow multiple rendering threads

cohtml.Net.CommonRenderingLibraryParams.AllowMultipleRenderingThreads Allows usage of Rendering Library calls from different threads. If not enabled, using rendering methods from different threads produces an error message. This option is useful when, for example, the client rendering backend records commands on different threads, that are later executed on a dedicated rendering thread. In the general use case where the rendering methods are called directly on the client’s rendering thread, this should be set to false, to warn when incorrect usage is detected.

Atlas text Dimension

Sets the width and height of the Text atlas in pixels. The default value is 1024. The values must be in the range from 64px to 8192px. If the given value is not a power of two it will be rounded up.

Enable support for HDRP/URP

Enables support for the HDRP/URP rendering pipelines. If you want to use this, you should set up HDRP/ URP first.

Memory tracking

Since memory tracking is a performance-heavy debugging tool, it is not enabled by default. When enabled from the Library configuration, Prysm will start tracking its own memory allocations and provide you with the following APIs:

// Returns the current number of active allocations
GetAllocationCount();
// Returns the total size of allocated memory in bytes
GetAllocatedMemory();
// Returns the total number of allocations for a given memory type
GetTotalsByType(cohtml::MemTags::MemTagsType memtag);
// Returns the current number of allocated bytes for a given memory type
GetCurrentBytesByType(cohtml::MemTags::MemTagsType memtag);
// Returns the current number of allocations for a given memory type
GetCurrentCountsByType(cohtml::MemTags::MemTagsType memtag);

You can invoke the APIs by using the cohtml.Net.UnityPlugin.Instance().<API>; call where API is one of the above functions.

Input

Disable or enable the Prysm integrated input handling for mouse, keyboard, gamepads or touches. Is enabled by default.

C# threads

Prysm uses threads spawned by C# scripts. This provides better integration with the Unity’s threading and allows the Cohtml library to execute C# code on threads different from the main one. Disabling the C# threads is possible and it is left as a legacy option. If the C# threads are disabled, the binary Cohtml plugin will create native C++ threads. The usage of the C# threads can be disabled in the Cohtml_Core\Runtime\Detail\Library.cs by setting cohtml.Library.s_ShouldUseCSharpThreads to fals or through the cohtml.Library.ShouldUseCSharpThreads setter. If the setter is used, the setting of the options should happen before the Cohtml library is initialized.