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
Exception | Condition |
---|---|
ArgumentNullException | uri is null or empty |
OperationCanceledException | Task canceled using ct |
FileNotFoundException | The file specified in uri was not found. |
NotSupportedException | uri is in an invalid format. |
IOException | An I/O error occurred while opening the file. |
InvalidOperationException | The stream is currently in use by a previous read operation. |
See Also
Reference
Texture2DExt Class
UltimateXR.Extensions.Unity.Render Namespace
System.Threading.Tasks.Task