Skip to content

Commit 0747eb9

Browse files
authored
fix: check if the lod file update time is creater than the updated av… (#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
2 parents db5b0e0 + 9ed907a commit 0747eb9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Runtime/Core/Scripts/Operations/MetadataDownloader.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,17 @@ private static bool IsUpdateRequired(AvatarContext context)
129129
return true;
130130
}
131131
AvatarMetadata previousMetadata = AvatarMetadata.LoadFromFile(context.AvatarUri.LocalMetadataPath);
132-
return AvatarMetadata.IsUpdated(context.Metadata, previousMetadata);
132+
return AvatarMetadata.IsUpdated(context.Metadata, previousMetadata) || ShouldUpdateAvatarFile(context);
133+
}
134+
135+
private static bool ShouldUpdateAvatarFile(AvatarContext context)
136+
{
137+
if (!File.Exists(context.AvatarUri.LocalModelPath))
138+
{
139+
return true;
140+
}
141+
var avatarFileUpdateTime = File.GetLastWriteTimeUtc(context.AvatarUri.LocalModelPath);
142+
return avatarFileUpdateTime < context.Metadata.UpdatedAt;
133143
}
134144

135145
/// <summary>

0 commit comments

Comments
 (0)