ImageExt.OverrideSpriteFromUriAsync Method

Loads a sprite asynchronously from an URI and assigns it to the overrideSprite property of an Image.

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

Syntax

C#

public static Task OverrideSpriteFromUriAsync(
	this Image self,
	string uri,
	CancellationToken ct = default
)


Parameters

 

self
Type: Image
Target image
uri
Type: System.String
File location. See Read(String, CancellationToken)
ct (Optional)
Type: System.Threading.CancellationToken
Optional cancellation token, to cancel the operation

Return Value

Type: Task
[Missing documentation for “M:UltimateXR.Extensions.Unity.Render.ImageExt.OverrideSpriteFromUriAsync(UnityEngine.UI.Image,System.String,System.Threading.CancellationToken)”]

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Image. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

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

ImageExt Class
UltimateXR.Extensions.Unity.Render Namespace