mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 09:47:39 +02:00
Editor stuff
This commit is contained in:
@ -0,0 +1,27 @@
|
||||
/// Credit SimonDarksideJ
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEngine.UI.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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user