Documentation › ThreadHarmonizerManager.EnqueueOnWorker
EnqueueOnWorker
Queues a one-time, Unity-independent action on the shared worker pool through the static manager API.
Static method
One-time work
C# API
METHOD SIGNATURE
static void EnqueueOnWorker(Action function);
Description
Schedules a parameterless action for asynchronous one-time execution on ThreadHarmonizer’s shared worker pool. Use only data that is independent from Unity APIs inside the worker action.
Shared worker pool
The static manager handles scheduling without MonoBehaviourMultithreaded inheritance.
Return through the queue
Use EnqueueOnMainThread when the result must update a Unity object.
Parameters
Name
Type
Description
function
Action
A parameterless action with no return value containing Unity-independent worker code.
Code Example
EXAMPLE
using ThreadHarmonizerEngine;
using UnityEngine;
public class StaticWorkerCalculation : MonoBehaviour
{
private float m_result;
private void Start()
{
float input = 12f;
ThreadHarmonizerManager.EnqueueOnWorker(() =>
{
m_result = input * input;
ThreadHarmonizerManager.EnqueueOnMainThread(() =>
{
Debug.Log(m_result);
});
});
}
}
