private static MaterialPropertyHandler GetShaderPropertyHandler(Shader shader, string name)
{
string[] propertyAttributes = ShaderUtil.GetShaderPropertyAttributes(shader, name);
if (propertyAttributes == null || propertyAttributes.Length == 0)
{
return((MaterialPropertyHandler)null);
}
MaterialPropertyHandler materialPropertyHandler = new MaterialPropertyHandler();
foreach (string attrib in propertyAttributes)
{
bool isDecorator;
MaterialPropertyDrawer shaderPropertyDrawer = MaterialPropertyHandler.GetShaderPropertyDrawer(attrib, out isDecorator);
if (shaderPropertyDrawer != null)
{
if (isDecorator)
{
if (materialPropertyHandler.m_DecoratorDrawers == null)
{
materialPropertyHandler.m_DecoratorDrawers = new List <MaterialPropertyDrawer>();
}
materialPropertyHandler.m_DecoratorDrawers.Add(shaderPropertyDrawer);
}
else
{
if (materialPropertyHandler.m_PropertyDrawer != null)
{
Debug.LogWarning((object)string.Format("Shader property {0} already has a property drawer", (object)name), (UnityEngine.Object)shader);
}
materialPropertyHandler.m_PropertyDrawer = shaderPropertyDrawer;
}
}
}
return(materialPropertyHandler);
}