From b2f256da089d03175cb460565248bbb763a9bcf9 Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Mon, 3 Jun 2024 20:18:13 +0300 Subject: [PATCH] fix: added avatar config to InCreatorLoader --- .../AvatarCreator/Scripts/InCreatorAvatarLoader.cs | 13 ++++++++++++- .../AvatarCreator/Scripts/Managers/AvatarManager.cs | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Runtime/AvatarCreator/Scripts/InCreatorAvatarLoader.cs b/Runtime/AvatarCreator/Scripts/InCreatorAvatarLoader.cs index 19ae8def..55bc9296 100644 --- a/Runtime/AvatarCreator/Scripts/InCreatorAvatarLoader.cs +++ b/Runtime/AvatarCreator/Scripts/InCreatorAvatarLoader.cs @@ -9,6 +9,17 @@ namespace ReadyPlayerMe.AvatarCreator /// public class InCreatorAvatarLoader { + private readonly AvatarConfig avatarConfig; + + public InCreatorAvatarLoader(AvatarConfig avatarConfig = null) + { + if (avatarConfig != null) + { + avatarConfig = AvatarLoaderSettings.LoadSettings().AvatarConfig; + } + this.avatarConfig = avatarConfig; + } + public async Task Load(string avatarId, BodyType bodyType, OutfitGender gender, byte[] data) { var avatarMetadata = new AvatarMetadata(); @@ -20,7 +31,7 @@ public async Task Load(string avatarId, BodyType bodyType, OutfitGen context.AvatarUri.Guid = avatarId; context.AvatarCachingEnabled = false; context.Metadata = avatarMetadata; - + context.AvatarConfig = avatarConfig; var executor = new OperationExecutor(new IOperation[] { new GltFastAvatarImporter(), diff --git a/Runtime/AvatarCreator/Scripts/Managers/AvatarManager.cs b/Runtime/AvatarCreator/Scripts/Managers/AvatarManager.cs index ae219178..74c324e1 100644 --- a/Runtime/AvatarCreator/Scripts/Managers/AvatarManager.cs +++ b/Runtime/AvatarCreator/Scripts/Managers/AvatarManager.cs @@ -50,7 +50,7 @@ public AvatarManager(AvatarConfig avatarConfig = null, CancellationToken token = } ctxSource = CancellationTokenSource.CreateLinkedTokenSource(token); - inCreatorAvatarLoader = new InCreatorAvatarLoader(); + inCreatorAvatarLoader = new InCreatorAvatarLoader(avatarConfig); avatarAPIRequests = new AvatarAPIRequests(ctxSource.Token); }