EnqueueOnMainThread


void EnqueueOnMainThread(Action function);

Runs a function on Unity’s main thread. This function should be used exclusively for accessing Unity’s main thread, given that most Unity functions can only be invoked from there.

Parameters

function

Function to be added. Only takes functions with no parameters and no return value.

Example