Skip to content

Commit

Permalink
fix: check if the lod file update time is creater than the updated av… (
Browse files Browse the repository at this point in the history
#277)

## [SDK-718](https://ready-player-me.atlassian.net/browse/SDK-718)

## Description

- issues with LOD's and avatars not being updated, when cache is
enabled.

## How to Test

- Create an avatar online with any application
- load avatar with LOD sample (paste avatar URL and load for the first
time)
- update same avatar in the web
- verify, that the avatar is updated for all of the LODs





[SDK-718]:
https://ready-player-me.atlassian.net/browse/SDK-718?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
rk132 authored May 21, 2024
2 parents db5b0e0 + 9ed907a commit 0747eb9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Runtime/Core/Scripts/Operations/MetadataDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,17 @@ private static bool IsUpdateRequired(AvatarContext context)
return true;
}
AvatarMetadata previousMetadata = AvatarMetadata.LoadFromFile(context.AvatarUri.LocalMetadataPath);
return AvatarMetadata.IsUpdated(context.Metadata, previousMetadata);
return AvatarMetadata.IsUpdated(context.Metadata, previousMetadata) || ShouldUpdateAvatarFile(context);
}

private static bool ShouldUpdateAvatarFile(AvatarContext context)
{
if (!File.Exists(context.AvatarUri.LocalModelPath))
{
return true;
}
var avatarFileUpdateTime = File.GetLastWriteTimeUtc(context.AvatarUri.LocalModelPath);
return avatarFileUpdateTime < context.Metadata.UpdatedAt;
}

/// <summary>
Expand Down

0 comments on commit 0747eb9

Please sign in to comment.