Files
VillageBuilder/Assets/Synty/InterfaceCore/Scripts/UnityUIExtensions/ShaderLibrary.cs
2026-06-11 17:30:53 +01:00

29 lines
926 B
C#

/// Credit SimonDarksideJ
/// Updated by Synty: Renamed Unity.UI.Extensions to Synty.Interface.Extensions to avoid conflicts with Unity Ui Extensions and to pass Unity asset store submission.
using System.Collections.Generic;
using UnityEngine;
namespace Synty.Interface.Extensions
{
public static class ShaderLibrary
{
public static Dictionary<string, Shader> shaderInstances = new Dictionary<string, Shader>();
public static Shader[] preLoadedShaders;
public static Shader GetShaderInstance(string shaderName)
{
if (shaderInstances.ContainsKey(shaderName))
{
return shaderInstances[shaderName];
}
var newInstance = Shader.Find(shaderName);
if (newInstance != null)
{
shaderInstances.Add(shaderName, newInstance);
}
return newInstance;
}
}
}