Skip to content

Commit

Permalink
Try get with textures
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Jul 14, 2024
1 parent 3289dfa commit 0b2fd6e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Winch/Util/TextureUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ public static class TextureUtil
{
private static Dictionary<string, Texture2D> TextureMap = new();

public static Texture2D? GetTexture(string key) => TextureMap[key];
public static Texture2D? GetTexture(string key)
{
if (TextureMap.TryGetValue(key, out Texture2D texture))
return texture;
else
return null;
}

public static Sprite GetSprite(string key)
{
Expand Down

0 comments on commit 0b2fd6e

Please sign in to comment.