public static MaterialData GetMaterial(Sprite sprite) { if (Instance == null) { return(null); } var key = sprite.name; if (!Instance.Cache.ContainsKey(key)) { var newMaterial = Instance.MakeNewMaterial(sprite); newMaterial.Material.name = key; Instance.Cache[key] = newMaterial; Logger.LogWarning($"GetMaterial key: {key} not in cache creating new one"); } return(Instance.Cache[key]); }