Skip to content

Commit

Permalink
fix: added avatar config to InCreatorLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisonHough committed Jun 3, 2024
1 parent 64eb501 commit b2f256d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion Runtime/AvatarCreator/Scripts/InCreatorAvatarLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ namespace ReadyPlayerMe.AvatarCreator
/// </summary>
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<GameObject> Load(string avatarId, BodyType bodyType, OutfitGender gender, byte[] data)
{
var avatarMetadata = new AvatarMetadata();
Expand All @@ -20,7 +31,7 @@ public async Task<GameObject> Load(string avatarId, BodyType bodyType, OutfitGen
context.AvatarUri.Guid = avatarId;
context.AvatarCachingEnabled = false;
context.Metadata = avatarMetadata;

context.AvatarConfig = avatarConfig;
var executor = new OperationExecutor<AvatarContext>(new IOperation<AvatarContext>[]
{
new GltFastAvatarImporter(),
Expand Down
2 changes: 1 addition & 1 deletion Runtime/AvatarCreator/Scripts/Managers/AvatarManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit b2f256d

Please sign in to comment.