GetFromMainThread


T GetFromMainThread<T>(Func<T> function);

Runs a function on Unity’s main thread, blocking the current background thread until a value is returned. This function should be used sparingly and only when necessary. If multiple values are required from the main thread, consider using a custom struct to encapsulate the data.

Parameters

function

Function to be added. Only takes functions with no parameters.