Texture2DExt.FromFile Method

Loads asynchronously a texture from a given file uri. See Read(String, CancellationToken) for information on the file location.

Namespace: UltimateXR.Extensions.Unity.Render
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public static Task<Texture2D> FromFile(
	string uri,
	CancellationToken ct = default
)


Parameters

 

uri
Type: System.String
Location of the texture file. See Read(String, CancellationToken)
ct (Optional)
Type: System.Threading.CancellationToken
Optional cancellation token, to cancel the operation.

Return Value

Type: Task(Texture2D)
An awaitable that returns the loaded texture

Exceptions

ExceptionCondition
ArgumentNullExceptionuri is null or empty
OperationCanceledExceptionTask canceled using ct
FileNotFoundExceptionThe file specified in uri was not found.
NotSupportedExceptionuri is in an invalid format.
IOExceptionAn I/O error occurred while opening the file.
InvalidOperationExceptionThe stream is currently in use by a previous read operation.

See Also

Reference

Texture2DExt Class
UltimateXR.Extensions.Unity.Render Namespace
System.Threading.Tasks.Task