Skip to content

Commit

Permalink
feat: added sprite cache revision
Browse files Browse the repository at this point in the history
  • Loading branch information
MSchmoecker committed Oct 31, 2023
1 parent 239832c commit fe776be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Fixed the debug mode Jötunn ASCII art
* Fixed AddComponentCopy was setting the name and tag of the Component's GameObject
* Fixed KeyHints for left hand items
* Fixed sprite rendering results in mostly empty sprites in Unity 2022, backwards compatible and an existing cached sprite will be recreated

## Version 2.14.5
* Fixed GUIManager assets not being properly initialized when later accessed, causing some elements to not show up
Expand Down
7 changes: 6 additions & 1 deletion JotunnLib/Managers/RenderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public class RenderManager : IManager
private static RenderManager _instance;
private Sprite EmptySprite { get; } = Sprite.Create(Texture2D.whiteTexture, Rect.zero, Vector2.one);

/// <summary>
/// Appended string to file names to force a cache recreation, if changed
/// </summary>
private static string cacheRevision = "c0";

/// <summary>
/// Singleton instance
/// </summary>
Expand Down Expand Up @@ -217,7 +222,7 @@ private void CacheIcon(GameObject target, BepInPlugin plugin, Sprite rendered)

private string GetCachePath(string name, string version)
{
return Path.Combine(Utils.Paths.IconCachePath, $"{name}-{version}.png");
return Path.Combine(Utils.Paths.IconCachePath, $"{name}-{version}-{cacheRevision}.png");
}

private string GetVersion(BepInPlugin plugin)
Expand Down

0 comments on commit fe776be

Please sign in to comment.