AvatarReady
Loading...
Searching...
No Matches
Inria.Avatar.AvatarReady.AvatarReadyRuntimeImportHelper Class Reference

Helper class to load avatars from AssetBundles. More...

Static Public Member Functions

static IEnumerator ApplyAvatar (AvatarReadySetup avatarReadyTarget, string avatarName, string provider, Action OnAvatarLoaded=null, Action OnLoadingFail=null)
 Method that loads the prefab which matches the avatarName and the current avatar provider of the AvatarReadySetup. Then calls to ApplyAvatar(AvatarReadySetup, GameObject, Action)
 
static IEnumerator ApplyAvatar (AvatarReadySetup avatarReadyTarget, GameObject avatarPrefab, Action OnAvatarLoaded=null)
 Method which instantiates an avatar prefab and configures it.
 
static IEnumerator LoadAssetbundle (string avatarName, Type avatarProvider)
 Pre-loads an avatar assetbundle to memory for rapid access.
 
static IEnumerator LoadFromResource (string avatarName, Type avatarProvider)
 Load an avatar from resources.
 
static string GetProvider (AvatarReady avatarReady)
 Get the provider for an avatar.
 
static string GetProvider (Type avatarProviderType)
 Get the provider from a provider type.
 
static Type GetProvider (string providerName)
 Get the provider type from a provider string name.
 

Static Private Attributes

static Dictionary< string, GameObject > avatarPrefabCache = new Dictionary<string, GameObject>()
 
static List< string > ongoingRequests = new List<string>()
 

Detailed Description

Helper class to load avatars from AssetBundles.

The main functions are:

  • ApplyAvatar, which loads a given avatar into an AvatarReadySetup configuration. It loads an avatar based on name and provider
  • PreLoadAvatar, pre-loads a prefab of an avatar to separate the loading of the loading process.

Member Function Documentation

◆ ApplyAvatar() [1/2]

static IEnumerator Inria.Avatar.AvatarReady.AvatarReadyRuntimeImportHelper.ApplyAvatar ( AvatarReadySetup avatarReadyTarget,
string avatarName,
string provider,
Action OnAvatarLoaded = null,
Action OnLoadingFail = null )
inlinestatic

Method that loads the prefab which matches the avatarName and the current avatar provider of the AvatarReadySetup. Then calls to ApplyAvatar(AvatarReadySetup, GameObject, Action)

Parameters
avatarReadyTargetTarget AvatarReadySetup
avatarNameName of the avatar
providerProvider of the avatar
OnAvatarLoadedOptional action to be performed once the avatar is loaded
OnLoadingFailOptional call to be performed when loading fails

◆ ApplyAvatar() [2/2]

static IEnumerator Inria.Avatar.AvatarReady.AvatarReadyRuntimeImportHelper.ApplyAvatar ( AvatarReadySetup avatarReadyTarget,
GameObject avatarPrefab,
Action OnAvatarLoaded = null )
inlinestatic

Method which instantiates an avatar prefab and configures it.

Parameters
avatarReadyTarget
avatarPrefab
OnAvatarLoaded

◆ LoadAssetbundle()

static IEnumerator Inria.Avatar.AvatarReady.AvatarReadyRuntimeImportHelper.LoadAssetbundle ( string avatarName,
Type avatarProvider )
inlinestatic

Pre-loads an avatar assetbundle to memory for rapid access.

Parameters
avatarNameName of the avatar
avatarProviderProvider

◆ GetProvider() [1/3]

static string Inria.Avatar.AvatarReady.AvatarReadyRuntimeImportHelper.GetProvider ( AvatarReady avatarReady)
inlinestatic

Get the provider for an avatar.

Parameters
avatarReadyThe avatar for which you want to get the provider
Returns
String name of the provider

◆ GetProvider() [2/3]

static string Inria.Avatar.AvatarReady.AvatarReadyRuntimeImportHelper.GetProvider ( Type avatarProviderType)
inlinestatic

Get the provider from a provider type.

Parameters
avatarProviderTypeThe provider type which you want to get the provider name
Returns
String name of the provider
Exceptions
NotSupportedExceptionThrow Not Supported Exception if type is not defined

◆ GetProvider() [3/3]

static Type Inria.Avatar.AvatarReady.AvatarReadyRuntimeImportHelper.GetProvider ( string providerName)
inlinestatic

Get the provider type from a provider string name.

Parameters
providerNamestring name of the provider
Returns
The provider type
Exceptions
NotSupportedExceptionThrow Not Supported Exception if provider name is not defined

The documentation for this class was generated from the following file: