Exemplo n.º 1
0
        /// <summary>
        /// Shaderから指定のnameのプロパティの description を取得する。
        /// </summary>
        /// <param name="shader"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        private static string getPropertyDescription(Shader shader, string name)
        {
#if UNITY_2019_1_OR_NEWER
            var idx = shader.FindPropertyIndex(name);
            if (0 <= idx)
            {
                return(shader.GetPropertyDescription(idx));
            }
            return(null);
#else
            for (int idx = ShaderUtil.GetPropertyCount(shader) - 1; 0 <= idx; idx--)
            {
                if (name == ShaderUtil.GetPropertyName(shader, idx))
                {
                    return(ShaderUtil.GetPropertyDescription(shader, idx));
                }
            }
            return(null);
#endif
        }
Exemplo n.º 2
0
        bool IsMaterialContainsMap(Material material, string slotName)
        {
#if UNITY_EDITOR
            if (material == null)
            {
                return(false);
            }
            Shader shader     = material.shader;
            int    propsCount = ShaderUtil.GetPropertyCount(shader);
            for (int i = 0; i < propsCount; i++)
            {
                if (ShaderUtil.GetPropertyName(shader, i) == slotName &&
                    ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
                {
                    return(true);
                }
            }
#endif
            return(false);
        }
        void GetPropertyPopup(FxSpriteSelector target)
        {
            Properties.Clear();
            var r = target.GetComponent <Renderer>();

            if (r.sharedMaterial)
            {
                var shader = r.sharedMaterial.shader;
                var c      = ShaderUtil.GetPropertyCount(shader);
                for (int i = 0; i < c; i++)
                {
                    if (ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
                    {
                        Properties.Add(ShaderUtil.GetPropertyName(shader, i));
                    }
                }
            }

            selectedPropertyID = Properties.FindIndex(t => t == target.Property);
        }
        private string[] getShaderPropsByType(List <ShaderUtil.ShaderPropertyType> valid, Material source)
        {
            if (source == null)
            {
                return(new[] { "-- no skybox mat --" });
            }
            var shader = source.shader;
            var res    = new List <string>();

            for (int i = 0; i < ShaderUtil.GetPropertyCount(shader); i++)
            {
                var type = ShaderUtil.GetPropertyType(shader, i);
                if (valid.Contains(type))
                {
                    res.Add(ShaderUtil.GetPropertyName(shader, i));
                }
            }

            return(res.Count == 0 ? new[] { "no valid properties" } : res.ToArray());
        }
Exemplo n.º 5
0
        public static bool TexEnvNameExists(Shader shader, string name)
        {
            if (shader != null)
            {
                var count = ShaderUtil.GetPropertyCount(shader);

                for (var i = 0; i < count; i++)
                {
                    if (ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
                    {
                        if (ShaderUtil.GetPropertyName(shader, i) == name)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Exemplo n.º 6
0
    static List <Texture> GetAllTexturesOfMaterial(Material mat)
    {
        if (!Application.isEditor)
        {
            return(null);
        }

        List <Texture> ret = new List <Texture> ();
        int            cnt = ShaderUtil.GetPropertyCount(mat.shader);

        for (int i = 0; i < cnt; i++)
        {
            if (ShaderUtil.GetPropertyType(mat.shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
            {
                string propName = ShaderUtil.GetPropertyName(mat.shader, i);
                ret.Add(mat.GetTexture(propName));
            }
        }
        return(ret);
    }
    private static List <Texture2D> FindAllTexture2Ds(Material material)
    {
        var allTexture = new List <Texture2D>();
        var shader     = material.shader;

        for (var i = 0; i < ShaderUtil.GetPropertyCount(shader); i++)
        {
            if (ShaderUtil.GetPropertyType(shader, i) != ShaderUtil.ShaderPropertyType.TexEnv)
            {
                continue;
            }
            var texture = material.GetTexture(ShaderUtil.GetPropertyName(shader, i)) as Texture2D;
            if (texture != null)
            {
                allTexture.Add(texture);
            }
        }

        return(allTexture);
    }
Exemplo n.º 8
0
        public static string MaterialPropertyName(string property, Material mat, ShaderUtil.ShaderPropertyType type)
        {
            Color tColor = GUI.color;
            // Create a list of available color and value properties
            List <string> props = new List <string>();

            int selectedPropIndex = 0;

            props.Add("(None)");

            if (mat != null)
            {
                int    propertyCount = ShaderUtil.GetPropertyCount(mat.shader);
                string propName      = string.Empty;
                for (int i = 0; i < propertyCount; i++)
                {
                    if (ShaderUtil.GetPropertyType(mat.shader, i) == type)
                    {
                        propName = ShaderUtil.GetPropertyName(mat.shader, i);
                        if (propName == property)
                        {
                            // We've found our current property
                            selectedPropIndex = props.Count;
                        }
                        props.Add(propName);
                    }
                }

                GUI.color = string.IsNullOrEmpty(property) ? HUXEditorUtils.DisabledColor : HUXEditorUtils.DefaultColor;
                int newPropIndex = EditorGUILayout.Popup(type.ToString(), selectedPropIndex, props.ToArray());
                property  = (newPropIndex > 0 ? props[newPropIndex] : string.Empty);
                GUI.color = HUXEditorUtils.DefaultColor;
                return(property);
            }
            else
            {
                WarningMessage("Can't get material " + type.ToString() + " properties because material is null.");
                GUI.color = HUXEditorUtils.DefaultColor;
                return(string.Empty);
            }
        }
Exemplo n.º 9
0
        public static void CopyPropertiesFrom(this Material to, Material from)
        {
            int count = ShaderUtil.GetPropertyCount(from.shader);

            for (int i = 0; i < count; i++)
            {
                var ty   = ShaderUtil.GetPropertyType(from.shader, i);
                var name = ShaderUtil.GetPropertyName(from.shader, i);
                switch (ty)
                {
                case ShaderUtil.ShaderPropertyType.Color:
                    to.SetColor(name, from.GetColor(name));
                    break;

                case ShaderUtil.ShaderPropertyType.Vector:
                    to.SetVector(name, from.GetVector(name));
                    break;

                case ShaderUtil.ShaderPropertyType.Float:
                    to.SetFloat(name, from.GetFloat(name));
                    break;

                case ShaderUtil.ShaderPropertyType.Range:
                    to.SetFloat(name, from.GetFloat(name));
                    break;

                case ShaderUtil.ShaderPropertyType.TexEnv:
                    to.SetTexture(name, from.GetTexture(name));
                    to.SetTextureOffset(name, from.GetTextureOffset(name));
                    to.SetTextureScale(name, from.GetTextureScale(name));
                    break;

                default:
                    break;
                }
            }
            to.renderQueue             = from.renderQueue;
            to.globalIlluminationFlags = from.globalIlluminationFlags;
            to.shaderKeywords          = from.shaderKeywords;
            to.enableInstancing        = from.enableInstancing;
        }
Exemplo n.º 10
0
		// 更新 Shader 数据
		void UpdateShader()
		{
			if (material)
			{
				if (_material.shader != _shader)
				{
					_shader = _material.shader;
					_propertyIndexInMenu = -2;

					if (_shader)
					{
						_propertyIndexes.Clear();
						_propertyCount = ShaderUtil.GetPropertyCount(_shader);

						for (int i = 0; i < _propertyCount; i++)
						{
							if (!ShaderUtil.IsShaderPropertyHidden(_shader, i) && ShaderUtil.GetPropertyType(_shader, i) == propertyType)
							{
								_propertyIndexes.Add(i);
							}
						}

						_propertyCount = _propertyIndexes.Count;
						if (_propertyCount > 0)
						{
							_propertyNames = new string[_propertyCount];
							_propertyDescriptions = new string[_propertyCount];

							for (int i = 0; i < _propertyCount; i++)
							{
								_propertyNames[i] = ShaderUtil.GetPropertyName(_shader, _propertyIndexes[i]);
								_propertyDescriptions[i] = string.Format("{0} ({1})",
									ShaderUtil.GetPropertyDescription(_shader, _propertyIndexes[i]),
									_propertyNames[i]);
							}
						}
					}
				}
			}
			else _shader = null;
		}
Exemplo n.º 11
0
        public static void GetMatTex(Material mat, List <Texture> lst)
        {
            Shader shader = mat.shader;
            int    count  = ShaderUtil.GetPropertyCount(shader);

            for (int i = 0; i < count; ++i)
            {
                string name = ShaderUtil.GetPropertyName(shader, i);
                ShaderUtil.ShaderPropertyType type = ShaderUtil.GetPropertyType(shader, i);
                switch (type)
                {
                case ShaderUtil.ShaderPropertyType.TexEnv:
                    Texture tex = mat.GetTexture(name);
                    if (tex != null)
                    {
                        lst.Add(tex);
                    }
                    break;
                }
            }
        }
Exemplo n.º 12
0
    /// <summary>
    /// 获得材质球所有的图片
    /// </summary>
    /// <param name="mat"></param>
    /// <returns></returns>
    public static Texture[] GetContainMaterialTextures(Material mat)
    {
        List <Texture> tex_list = new List <Texture>();

        Shader shader = mat.shader;

        for (int i = 0; i < ShaderUtil.GetPropertyCount(shader); i++)
        {
            if (ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
            {
                string  propertyName = ShaderUtil.GetPropertyName(shader, i);
                Texture tex          = mat.GetTexture(propertyName);
                if (tex != null)
                {
                    tex_list.Add(tex);
                }
            }
        }

        return(tex_list.ToArray());
    }
    public static IEnumerable <string> GetUniqueShaderPropertyNames(IEnumerable <Shader> shaders)
    {
        shaders = shaders.Distinct();

        List <string> shaderProperties = new List <string>();

        foreach (Shader currentShader in shaders)
        {
            int count = ShaderUtil.GetPropertyCount(currentShader);

            for (int i = 0; i < count; i++)
            {
                if (ShaderUtil.GetPropertyType(currentShader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
                {
                    shaderProperties.Add(ShaderUtil.GetPropertyName(currentShader, i));
                }
            }
        }

        return(shaderProperties.Distinct());
    }
Exemplo n.º 14
0
        public static ShaderProps FromShader(Shader shader, string[] normamMapProps = null)
        {
            var properties = new List <ShaderProperty>();

            for (int i = 0; i < ShaderUtil.GetPropertyCount(shader); ++i)
            {
                var name        = ShaderUtil.GetPropertyName(shader, i);
                var propType    = ShaderUtil.GetPropertyType(shader, i);
                var isNormalMap = normamMapProps != null
                    ? Array.IndexOf(normamMapProps, name) != -1
                    : false
                ;

                properties.Add(new ShaderProperty(name, ConvType(propType), isNormalMap));
            }

            return(new ShaderProps
            {
                Properties = properties.ToArray(),
            });
        }
Exemplo n.º 15
0
        private void RegenerateTextures()
        {
            graphNames.Clear();
            graphExpansions.Clear();
            graphScrolls.Clear();
            textureNames.Clear();
            textures.Clear();

            if (substance != null)
            {
                for (int i = 0; i < substance.graphs.Count; i++)
                {
                    graphNames.Add(substance.graphs[i].name);
                    graphExpansions.Add(true);
                    graphScrolls.Add(Vector2.zero);
                    textureNames.Add(new List <string>());
                    textures.Add(new List <Texture>());

                    Material graphMat  = substance.graphs[i].material;
                    int      propCount = ShaderUtil.GetPropertyCount(graphMat.shader);

                    for (int j = 0; j < propCount; j++)
                    {
                        if (ShaderUtil.GetPropertyType(graphMat.shader, j) == ShaderUtil.ShaderPropertyType.TexEnv)
                        {
                            string  texName = ShaderUtil.GetPropertyName(graphMat.shader, j);
                            Texture tex     = graphMat.GetTexture(texName);

                            if (tex == null)
                            {
                                continue;
                            }

                            textureNames[i].Add(texName);
                            textures[i].Add(tex);
                        }
                    }
                }
            }
        }
Exemplo n.º 16
0
        bool DrawShaderPropertyOptions(SerializedProperty pLayer)
        {
            SerializedProperty shaderProperty = pLayer.FindPropertyRelative("mShaderProperty");
            SerializedProperty materialID     = pLayer.FindPropertyRelative("mMaterialID");

            List <string> texturePropertyNames = new List <string>();
            List <string> textureDescriptions  = new List <string>();
            Shader        shader = mMaterialMotion.GetComponent <Renderer>().sharedMaterials[materialID.intValue].shader;

            for (int i = 0; i < ShaderUtil.GetPropertyCount(shader); ++i)
            {
                switch (ShaderUtil.GetPropertyType(shader, i))
                {
                case ShaderUtil.ShaderPropertyType.TexEnv:
                case ShaderUtil.ShaderPropertyType.Float:
                case ShaderUtil.ShaderPropertyType.Color:
                case ShaderUtil.ShaderPropertyType.Range:
                    textureDescriptions.Add(ShaderUtil.GetPropertyDescription(shader, i));
                    texturePropertyNames.Add(ShaderUtil.GetPropertyName(shader, i));
                    break;
                }
            }
            if (texturePropertyNames.Count == 0)
            {
                EditorGUILayout.HelpBox("Shader does not have any valid Inputs (Texture, Float, Color)", MessageType.Info);
                return(true);
            }

            int index = texturePropertyNames.FindIndex(x => x.Equals(shaderProperty.stringValue));

            if (index == -1)
            {
                index = 0;
            }
            index = EditorGUILayout.Popup("Shader Property:", index, textureDescriptions.ToArray());
            shaderProperty.stringValue = texturePropertyNames[index];
            pLayer.FindPropertyRelative("mMotionProperty").enumValueIndex = (int)ShaderUtil.GetPropertyType(shader, index);

            return(false);
        }
Exemplo n.º 17
0
        public static MaterialItem Create(Material material)
        {
            var item = new MaterialItem
            {
                Material = material
            };

#if UNITY_EDITOR
            var propNames = new List <string>();
            for (int i = 0; i < ShaderUtil.GetPropertyCount(material.shader); ++i)
            {
                var propType = ShaderUtil.GetPropertyType(material.shader, i);
                var name     = ShaderUtil.GetPropertyName(material.shader, i);

                switch (propType)
                {
                case ShaderUtil.ShaderPropertyType.Color:
                    item.PropMap.Add(name, new PropItem
                    {
                        PropertyType  = propType,
                        DefaultValues = material.GetColor(name),
                    });
                    propNames.Add(name);
                    break;

                case ShaderUtil.ShaderPropertyType.TexEnv:
                    name += "_ST";
                    item.PropMap.Add(name, new PropItem
                    {
                        PropertyType  = propType,
                        DefaultValues = material.GetVector(name),
                    });
                    propNames.Add(name);
                    break;
                }
            }
            item.PropNames = propNames.ToArray();
#endif
            return(item);
        }
Exemplo n.º 18
0
        public void AllPropertiesExist()
        {
            Dictionary <string, Schema.ShaderProperty> dictProperties = new Dictionary <string, ShaderProperty>();

            for (int i = 0; i < material.PropertiesLength; i++)
            {
                Schema.ShaderProperty p = material.GetProperties(i);
                dictProperties.Add(p.Names, p);
            }


            int count = ShaderUtil.GetPropertyCount(originMaterial.shader);

            Assert.AreEqual(count, material.PropertiesLength);


            for (int i = 0; i < count; i++)
            {
                string name = ShaderUtil.GetPropertyName(originMaterial.shader, i);
                Assert.IsTrue(dictProperties.ContainsKey(name));
            }
        }
 public static bool FindMatError(Material mat)
 {
     if (mat == null)
     {
         return(true);
     }
     for (int si = 0; si < ShaderUtil.GetPropertyCount(mat.shader); si++)
     {
         ShaderUtil.ShaderPropertyType st = ShaderUtil.GetPropertyType(mat.shader, si);
         if (st == ShaderUtil.ShaderPropertyType.TexEnv)
         {
             string  strProperty = ShaderUtil.GetPropertyName(mat.shader, si);
             Texture tex         = mat.GetTexture(strProperty);
             if (tex == null)
             {
                 Debug.LogError("材质贴图丢失,材质名:" + mat.name);
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 20
0
        public static IEnumerable <Texture2D> GetTextures(this Material m)
        {
#if UNITY_EDITOR
            for (int i = 0; i < ShaderUtil.GetPropertyCount(m.shader); ++i)
            {
                if (ShaderUtil.GetPropertyType(m.shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
                {
                    var texture = m.GetTexture(ShaderUtil.GetPropertyName(m.shader, i)) as Texture2D;
                    if (texture != null)
                    {
                        yield return(texture);
                    }
                }
            }
#else
            var texture = m.mainTexture as Texture2D;
            if (texture != null)
            {
                yield return(texture);
            }
#endif
        }
Exemplo n.º 21
0
    public static Dictionary <string, Texture> getTextures(Material material)
    {
        string assetPath = AssetDatabase.GetAssetPath(material);

        if (String.IsNullOrEmpty(assetPath))
        {
            return(null);
        }

        Shader shader = material.shader;
        Dictionary <string, Texture> textures = new Dictionary <string, Texture>();

        for (int i = 0; i < ShaderUtil.GetPropertyCount(shader); i++)
        {
            if (ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
            {
                string propertyName = ShaderUtil.GetPropertyName(shader, i);
                textures.Add(propertyName, material.GetTexture(propertyName));
            }
        }
        return(textures);
    }
Exemplo n.º 22
0
        private static void FindMaterialReferenceRecursive(Material material, ReferenceDictionary dictionary)
        {
            if (material.shader == null)
            {
                return;
            }

            //設定中のシェーダーに存在するプロパティの取得
            var count         = ShaderUtil.GetPropertyCount(material.shader);
            var propertyNames = new string[count];

            for (int i = 0; i < count; i++)
            {
                string propName = ShaderUtil.GetPropertyName(material.shader, i);
                propertyNames[i] = propName;
            }

            var serializedObject = new SerializedObject(material);
            var texturesProperty = serializedObject.FindProperty("m_SavedProperties.m_TexEnvs");

            for (int i = 0; i < texturesProperty.arraySize; i++)
            {
                var textureContainerProperty = texturesProperty.GetArrayElementAtIndex(i);
                var textureName = textureContainerProperty.FindPropertyRelative("first").stringValue;
                // シェーダーに存在するテクスチャ指定プロパティ以外は無視
                if (!propertyNames.Contains(textureName))
                {
                    continue;
                }

                var texture = textureContainerProperty.FindPropertyRelative("second.m_Texture").objectReferenceValue;
                if (texture == null)
                {
                    continue;
                }

                dictionary.AddReference(material, texture);
            }
        }
Exemplo n.º 23
0
        private static string[] GetProperties()
        {
            Shader        shader = (Shader)Selection.activeObject;
            int           count  = ShaderUtil.GetPropertyCount(shader);
            List <string> menus  = new List <string>();
            List <string> props  = new List <string>();

            for (int i = 0; i < count; i++)
            {
                string n = ShaderUtil.GetPropertyName(shader, i);
                if (n.StartsWith("m_") || n.StartsWith("g_"))
                {
                    menus.Add(n);
                }
                else
                {
                    props.Add(n);
                }
            }
            menus.AddRange(props);
            return(menus.ToArray());
        }
        private static string[] FindTexProperties(Shader shader)
        {
            int count = ShaderUtil.GetPropertyCount(shader);

            if (count <= 0)
            {
                return(null);
            }

            List <string> texProperties = new List <string>();

            texProperties.Add("Select");
            for (int i = 0; i < count; i++)
            {
                if (ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
                {
                    texProperties.Add(ShaderUtil.GetPropertyName(shader, i));
                }
            }

            return(texProperties.ToArray());
        }
            public AdvancedShader(Shader _shader)
            {
                if (_shader == null)
                {
                    throw new Exception("[ShaderUtility] Couldnt find shader with name");
                }

                // Initialize
                ShaderName         = _shader.name;
                ShaderPropertyList = new List <ShaderProperty>();

                // Iterate through properties
                int _propertyCount = ShaderUtil.GetPropertyCount(_shader);

                for (int _iter = 0; _iter < _propertyCount; _iter++)
                {
                    ShaderProperty _property = new ShaderProperty(ShaderUtil.GetPropertyName(_shader, _iter), ShaderUtil.GetPropertyType(_shader, _iter));

                    // Add it to list
                    ShaderPropertyList.Add(_property);
                }
            }
Exemplo n.º 26
0
            public static List <string> GetShaderFeatures(Material material)
            {
                List <string> features = new List <string>();

                var propsCount = ShaderUtil.GetPropertyCount(material.shader);

                for (int i = 0; i < propsCount; i++)
                {
                    var propName = ShaderUtil.GetPropertyName(material.shader, i);

                    if (propName.ToUpper() == propName)
                    {
                        if (features.Contains(propName) == false)
                        {
                            features.Add(propName);
                            //Debug.Log(propName);
                        }
                    }
                }

                return(features);
            }
Exemplo n.º 27
0
            public static void GetShaderValue(Material mat, List <ShaderValue> shaderValueLst)
            {
                Shader shader = mat.shader;
                int    count  = ShaderUtil.GetPropertyCount(shader);

                for (int i = 0; i < count; ++i)
                {
                    ShaderValue sv   = null;
                    string      name = ShaderUtil.GetPropertyName(shader, i);
                    ShaderUtil.ShaderPropertyType type = ShaderUtil.GetPropertyType(shader, i);
                    switch (type)
                    {
                    case ShaderUtil.ShaderPropertyType.Color:
                        sv = new ShaderColorValue(name, type, mat);
                        break;

                    case ShaderUtil.ShaderPropertyType.Vector:
                        sv = new ShaderVectorValue(name, type, mat);
                        break;

                    case ShaderUtil.ShaderPropertyType.Float:
                        sv = new ShaderFloatValue(name, type, mat);
                        break;

                    case ShaderUtil.ShaderPropertyType.Range:
                        sv = new ShaderFloatValue(name, type, mat);
                        break;

                    case ShaderUtil.ShaderPropertyType.TexEnv:
                        sv = new ShaderTexValue(name, type, mat);
                        break;
                    }
                    shaderValueLst.Add(sv);
                }
                ShaderKeyWordValue keyword = new ShaderKeyWordValue(mat);

                shaderValueLst.Add(keyword);
            }
    private void RestoreTextureSlots()
    {
        for (int i = 0; i < allRenderers.Length; i++)
        {
            Renderer r = allRenderers[i];

            for (int j = 0; j < r.sharedMaterials.Length; j++)
            {
                Material m = r.sharedMaterials[j];
                Shader   s = m.shader;

                for (int n = 0; n < ShaderUtil.GetPropertyCount(s); n++)
                {
                    if (ShaderUtil.GetPropertyType(s, n) == ShaderUtil.ShaderPropertyType.TexEnv)
                    {
                        string propName = ShaderUtil.GetPropertyName(s, n);
                        m.SetTexture(propName, oldTextures[i][j][n]);
                    }
                }
            }
        }
        Debug.Log("Restored texture slots.");
    }
        // Cache properties of a given shader if it's
        // different from a previously given one.
        void CachePropertyList(Shader shader)
        {
            if (_cachedShader == shader)
            {
                return;
            }

            var temp = new List <string>();

            var count = ShaderUtil.GetPropertyCount(shader);

            for (var i = 0; i < count; i++)
            {
                var propType = ShaderUtil.GetPropertyType(shader, i);
                if (propType == ShaderUtil.ShaderPropertyType.Color)
                {
                    temp.Add(ShaderUtil.GetPropertyName(shader, i));
                }
            }

            _propertyList = temp.ToArray();
            _cachedShader = shader;
        }
Exemplo n.º 30
0
        void OnEnable()
        {
            MeshRenderer renderer = GetComponent <MeshRenderer>();

            if (renderer == null)
            {
                return;
            }
            foreach (Material sharedMaterial in renderer.sharedMaterials)
            {
                Shader shader = sharedMaterial.shader;
                Debug.Log("Scanning " + sharedMaterial.name + " : " + shader.name);
                List <string> props = new List <string>();
                for (int i = 0; i < ShaderUtil.GetPropertyCount(shader); i++)
                {
                    string propertyName = ShaderUtil.GetPropertyName(shader, i);
                    ShaderUtil.ShaderPropertyType propertyType = ShaderUtil.GetPropertyType(shader, i);
                    props.Add(propertyName);
                    Debug.Log(propertyName + " of type " + propertyType.ToString());
                }
                //Debug.Log(string.Join("\n", props.ToArray()));
            }
        }