cohtml.CohtmlPluginManager

Manage Cohtml Plugin MonoBehaviour events and ensure they are invoked at the appropriate moments. The instance of the object should be unique for the entire lifespan of the application.

Inherits from MonoBehaviour

Public Functions

Name
CohtmlPluginManagerGetOrInitInstance()
If there is no reference, it creates one, or returns the existing instance of the scene if one already exists.
voidRunOnMainThread(Action action)
Ensures that the specified action is executed on the main thread. If the caller is already on the main thread, the action is invoked immediately. Otherwise, it is posted to the main thread’s synchronization context for execution.
virtual voidAwake()
Initializes the main Unity plugin instance and sets up the synchronization context for main-thread operations.
voidReset()
Resets the component state and destroys redundant instances if this is not the primary singleton.
voidOnDestroy()
Stops coroutines and clears the singleton reference.

Protected Functions

Name
virtual voidOnGUI()
Triggers backend end frame rendering during Repaint.
virtual voidOnApplicationQuit()
Performs cleanup of Cohtml library and plugin instance.

Public Properties

Name
CohtmlPluginManagerInstance
The singleton instance of the PluginManager component. Monitor whether this component is the only one in the entire lifetime of the application. If an additional component is created, make sure it is destroyed to avoid duplicates.

Public Attributes

Name
const stringCohtmlPluginManagerObjectName

Public Functions Documentation

function GetOrInitInstance

static CohtmlPluginManager GetOrInitInstance()

If there is no reference, it creates one, or returns the existing instance of the scene if one already exists.

Return: The reference to the instance that was found or created

function RunOnMainThread

static void RunOnMainThread(
    Action action
)

Ensures that the specified action is executed on the main thread. If the caller is already on the main thread, the action is invoked immediately. Otherwise, it is posted to the main thread’s synchronization context for execution.

Parameters:

  • action The action to execute on the main thread.

function Awake

virtual void Awake()

Initializes the main Unity plugin instance and sets up the synchronization context for main-thread operations.

function Reset

void Reset()

Resets the component state and destroys redundant instances if this is not the primary singleton.

function OnDestroy

void OnDestroy()

Stops coroutines and clears the singleton reference.

Protected Functions Documentation

function OnGUI

virtual void OnGUI()

Triggers backend end frame rendering during Repaint.

function OnApplicationQuit

virtual void OnApplicationQuit()

Performs cleanup of Cohtml library and plugin instance.

Public Property Documentation

property Instance

static CohtmlPluginManager Instance;

The singleton instance of the PluginManager component. Monitor whether this component is the only one in the entire lifetime of the application. If an additional component is created, make sure it is destroyed to avoid duplicates.

Public Attributes Documentation

variable CohtmlPluginManagerObjectName

const string CohtmlPluginManagerObjectName = "CohtmlPluginManager";