Class AvatarLayerFactory
Factory for creating runtime avatar layer variants by cloning an existing layer and replacing its texture.
public static class AvatarLayerFactory
- Inheritance
-
AvatarLayerFactory
- Inherited Members
Methods
CloneAvatarLayerWithTexture(string, string, Texture2D, string?)
Clones an avatar layer asset and replaces its primary texture.
public static Object? CloneAvatarLayerWithTexture(string sourceResourcePath, string newName, Texture2D replacementTexture, string? targetResourcePath = null)
Parameters
sourceResourcePathstringThe Resources path to the source avatar layer.
newNamestringThe display name to assign to the cloned layer.
replacementTextureTexture2DThe replacement texture to assign to the cloned layer.
targetResourcePathstringOptional target resource path for the cloned layer.
Returns
- Object
The cloned avatar layer object, or null if cloning failed.
CreateAndRegisterAvatarLayer(string, string, string, Texture2D)
Creates and registers a cloned avatar layer with a replacement texture.
public static bool CreateAndRegisterAvatarLayer(string sourceResourcePath, string targetResourcePath, string newName, Texture2D replacementTexture)
Parameters
sourceResourcePathstringThe Resources path to the source avatar layer.
targetResourcePathstringThe Resources path where the cloned layer will be registered.
newNamestringThe display name to assign to the cloned layer.
replacementTextureTexture2DThe replacement texture to assign to the cloned layer.
Returns
RegisterAvatarLayer(string, Object)
Registers a cloned avatar layer so it can be resolved through UnityEngine.Resources.Load(System.String).
public static bool RegisterAvatarLayer(string resourcePath, Object avatarLayer)
Parameters
resourcePathstringThe Resources path to register the avatar layer at.
avatarLayerObjectThe cloned avatar layer object to register.