The CompileIfNeededAsync
method is an asynchronous operation that checks if an asset needs to be compiled and performs the compilation if necessary. It returns a ValueTask<bool>
indicating whether the asset was compiled.
The CompileIfNeededAsync
method is an asynchronous operation that checks if an asset needs to be compiled and performs the compilation if necessary. It returns a ValueTask<bool>
indicating whether the asset was compiled.
To use the CompileIfNeededAsync
method, call it on an instance of the Editor.Asset
class, passing a float
value as the timeout
parameter. This parameter specifies the maximum time, in seconds, to wait for the compilation process to complete.
The method returns a ValueTask<bool>
, where the result is true
if the asset was compiled, and false
if it was already up-to-date or if the compilation was not needed.
// Example usage of CompileIfNeededAsync public async Task<bool> CheckAndCompileAssetAsync(Editor.Asset asset, float timeout) { // Attempt to compile the asset if needed bool wasCompiled = await asset.CompileIfNeededAsync(timeout); // Return the result return wasCompiled; }