SpriteExt.ReadSpriteFileAsync Method
Loads asynchronously a sprite 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<Sprite> ReadSpriteFileAsync(
Image targetImage,
string uri,
CancellationToken ct = default
)
Parameters
- targetImage
- Type: Image
Image component the sprite will be used for - uri
- Type: System.String
File location. Read(String, CancellationToken) for more information - ct (Optional)
- Type: System.Threading.CancellationToken
Optional cancellation token, to cancel the operation.
Return Value
Type: Task(Sprite)
An awaitable that returns the loaded sprite
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
SpriteExt Class
UltimateXR.Extensions.Unity.Render Namespace
System.Threading.Tasks.Task