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

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

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