cohtml.Net.UnityPlugin

Establish the connection between Unity3D integration and the Native Cohtml SDK.

Inherits from SystemIDisposable

Public Types

Name
enum classEventTypes { UET_DrawView = 1, UET_SetRenderTarget = 2, UET_CreateSystemRenderer = 3, UET_CreateViewRenderer = 4, UET_DestroySystemRenderer = 5, UET_DestroyViewRenderer = 6, UET_BackendBeginFrame = 7, UET_BackendEndFrame = 8}
enum classRenoirRenderingEvent { RRE_InitializeRenderingResources = 1, RRE_DestroyRenderingResources = 2, RRE_ExecuteCaptureBuffer = 3, RRE_BeginFrame = 4, RRE_EndFrame = 5}

Public Functions

Name
virtual voidDispose()
boolEnsureRenoirLibrary(LibraryParams arg0)
Creates a rendering for the library and checks if it is running and available for use.
voidSetRenderTextureData(global.System.IntPtr texturePtr, global.System.IntPtr bufferPtr, uint width, uint height, uint antialiasingLevel, uint wideTexture)
Registering a render texture with specific settings, which will be used for drawing the UI displayed by a designated CohtmlView.
voidSetUserBackground(uint systemId, uint viewId, global.System.IntPtr texturePtr, uint width, uint height, int format, uint flipY)
The background where the UI scene will be drawn.
voidProcessResources()
Update the processes of a given system, which includes sending log messages from Cohtml, announcing the deletion of cached textures, and destroying pending Views and Systems objects.
voidOnEditorQuit()
Deinitialization of Cohtml Native objects begins upon exiting the Unity3D Editor.
voidDestroySystems()
Destroy all systems, ensuring the destruction of all associated objects before proceeding.
voidOnApplicationQuit()
Initiating the completion of internal processes in the Native Cohtml SDK, which are mandatory when shutting down the Unity3D application.
voidUnityRenderEvent(int eventID)
Registers events to be executed on the application’s render thread.
voidSetShouldUseCSharpBackend(bool shouldUse)
Will make the plugin to switch from Native rendering backend to Unity3D CSharp rendering backend which uses Unity’s rendering API.
voidSetLibraryMultithreadAwareness(bool enable)
Reserved method for internal usage. Do not use.
voidSetActiveColorSpace(int colorSpace)
uintGetAllocationCount()
uintGetAllocatedMemory()
uintGetTotalAllocations()
uintGetTotalsByType(MemTagsType memtag)
uintGetCurrentBytesByType(MemTagsType memtag)
uintGetCurrentCountsByType(MemTagsType memtag)
ulongGetTimeSpentInAllocationsNs()
voidEnableMemoryTracking(bool enable)
Enables extracting detailed information about the allocated GPU memory in the Library.
voidSetUnityVersion(string str)
Send the Unity3D engine version to the Native Cohtml Plugin.

Public Properties

Name
UnityPluginInstance
The singleton instance of the UnityPlugin.

Public Attributes

Name
UnityPlugins_Instance

Protected Attributes

Name
boolswigCMemOwn

Public Types Documentation

enum EventTypes

EnumeratorValueDescription
UET_DrawView1
UET_SetRenderTarget2
UET_CreateSystemRenderer3
UET_CreateViewRenderer4
UET_DestroySystemRenderer5
UET_DestroyViewRenderer6
UET_BackendBeginFrame7
UET_BackendEndFrame8

enum RenoirRenderingEvent

EnumeratorValueDescription
RRE_InitializeRenderingResources1
RRE_DestroyRenderingResources2
RRE_ExecuteCaptureBuffer3
RRE_BeginFrame4
RRE_EndFrame5

Public Functions Documentation

function Dispose

virtual void Dispose()

function EnsureRenoirLibrary

bool EnsureRenoirLibrary(
    LibraryParams arg0
)

Creates a rendering for the library and checks if it is running and available for use.

function SetRenderTextureData

void SetRenderTextureData(
    global.System.IntPtr texturePtr,
    global.System.IntPtr bufferPtr,
    uint width,
    uint height,
    uint antialiasingLevel,
    uint wideTexture
)

Registering a render texture with specific settings, which will be used for drawing the UI displayed by a designated CohtmlView.

Parameters:

  • texturePtr Pointer of the texture reference created by Unity3D engine.
  • bufferPtr Pointer reference used for the buffer depth texture.
  • width The width of the texture.
  • height The height of the texture.
  • antialiasingLevel The antialiasing level determines the count of the samples.
  • wideTexture Determines whether the texture is a Wide Texture.

function SetUserBackground

void SetUserBackground(
    uint systemId,
    uint viewId,
    global.System.IntPtr texturePtr,
    uint width,
    uint height,
    int format,
    uint flipY
)

The background where the UI scene will be drawn.

Parameters:

  • systemId ID of the system that stores this image.
  • viewId ID of the View that stores this image.
  • texturePtr Pointer to a user-defined representation of the texture. Will be passed as-is to the graphics backend.
  • width The width of the texture.
  • height The height of the texture.
  • format Pixel format of the texture.
  • flipY Determines the origin of the texture is flipped by Y rotation.

function ProcessResources

void ProcessResources()

Update the processes of a given system, which includes sending log messages from Cohtml, announcing the deletion of cached textures, and destroying pending Views and Systems objects.

function OnEditorQuit

void OnEditorQuit()

Deinitialization of Cohtml Native objects begins upon exiting the Unity3D Editor.

function DestroySystems

void DestroySystems()

Destroy all systems, ensuring the destruction of all associated objects before proceeding.

function OnApplicationQuit

void OnApplicationQuit()

Initiating the completion of internal processes in the Native Cohtml SDK, which are mandatory when shutting down the Unity3D application.

function UnityRenderEvent

void UnityRenderEvent(
    int eventID
)

Registers events to be executed on the application’s render thread.

Parameters:

  • eventID is a composite binary number that contains information about the event type, the ID of the system to which the event is addressed, and the ID of the view to which the event is directed.

function SetShouldUseCSharpBackend

void SetShouldUseCSharpBackend(
    bool shouldUse
)

Will make the plugin to switch from Native rendering backend to Unity3D CSharp rendering backend which uses Unity’s rendering API.

Parameters:

  • shouldUse boolean determine to enable the CSharp rendering backend.

function SetLibraryMultithreadAwareness

void SetLibraryMultithreadAwareness(
    bool enable
)

Reserved method for internal usage. Do not use.

function SetActiveColorSpace

void SetActiveColorSpace(
    int colorSpace
)

function GetAllocationCount

uint GetAllocationCount()

function GetAllocatedMemory

uint GetAllocatedMemory()

function GetTotalAllocations

uint GetTotalAllocations()

function GetTotalsByType

uint GetTotalsByType(
    MemTagsType memtag
)

function GetCurrentBytesByType

uint GetCurrentBytesByType(
    MemTagsType memtag
)

function GetCurrentCountsByType

uint GetCurrentCountsByType(
    MemTagsType memtag
)

function GetTimeSpentInAllocationsNs

ulong GetTimeSpentInAllocationsNs()

function EnableMemoryTracking

static void EnableMemoryTracking(
    bool enable
)

Enables extracting detailed information about the allocated GPU memory in the Library.

Parameters:

  • enable True to enable and false to disable the feature.

function SetUnityVersion

static void SetUnityVersion(
    string str
)

Send the Unity3D engine version to the Native Cohtml Plugin.

Public Property Documentation

property Instance

static UnityPlugin Instance;

The singleton instance of the UnityPlugin.

Public Attributes Documentation

variable s_Instance

static UnityPlugin s_Instance;

Protected Attributes Documentation

variable swigCMemOwn

bool swigCMemOwn;