Class URIAvDataLoader
- Namespace
- Uralstech.AvLoader.DataLoaders
Loads avatar data from remote URIs via UnityWebRequest.Get(Uri). Downloads are performed in parallel.
public class URIAvDataLoader : IAvDataLoader
- Inheritance
-
objectURIAvDataLoader
- Implements
Constructors
URIAvDataLoader(string, string, AvModelFileExtension, string?, string?, Encoding?)
Creates a loader configured to download avatar data from explicit URIs.
public URIAvDataLoader(string modelURI, string metadataURI, AvModelFileExtension modelFormat, string? fullRenderURI = null, string? bustRenderURI = null, Encoding? metadataEncoding = null)
Parameters
modelURIstringDirect URI to the avatar model file.
metadataURIstringDirect URI to the metadata JSON file.
modelFormatAvModelFileExtensionThe file format/extension of the model. Must be explicitly specified (no auto-detection like with FileAvDataLoader).
fullRenderURIstringOptional URI to the full-body render image.
bustRenderURIstringOptional URI to the bust/half-body render image.
metadataEncodingEncodingText encoding for the metadata JSON. Defaults to UTF-8.
Exceptions
- ArgumentException
Thrown if
modelFormatis None, as URI-based loading requires an explicit format.
URIAvDataLoader(Uri, Uri, AvModelFileExtension, Uri?, Uri?, Encoding?)
Creates a loader configured to download avatar data from explicit URIs.
public URIAvDataLoader(Uri modelURI, Uri metadataURI, AvModelFileExtension modelFormat, Uri? fullRenderURI = null, Uri? bustRenderURI = null, Encoding? metadataEncoding = null)
Parameters
modelURIUriDirect URI to the avatar model file.
metadataURIUriDirect URI to the metadata JSON file.
modelFormatAvModelFileExtensionThe file format/extension of the model. Must be explicitly specified (no auto-detection like with FileAvDataLoader).
fullRenderURIUriOptional URI to the full-body render image.
bustRenderURIUriOptional URI to the bust/half-body render image.
metadataEncodingEncodingText encoding for the metadata JSON. Defaults to UTF-8.
Exceptions
- ArgumentException
Thrown if
modelFormatis None, as URI-based loading requires an explicit format.
Fields
WebRequestConfigurationCallback
Called each time a new UnityWebRequest is created, e.g. for auth configuration.
public Func<UnityWebRequest, Awaitable>? WebRequestConfigurationCallback
Field Value
- Func<UnityWebRequest, Awaitable>
Methods
LoadAvatarAsync(bool, CancellationToken)
Tries loading an avatar into an AvSourceData.
public Awaitable<AvSourceData?> LoadAvatarAsync(bool throwOnFail, CancellationToken token = default)
Parameters
throwOnFailboolShould this method throw errors on failures or log them as warnings and return null?
tokenCancellationToken
Returns
- Awaitable<AvSourceData>
The loaded data if successful; null on failure.