UnityEngine.Material.HasProperty C# (CSharp) Method

HasProperty() public method

Checks if material's shader has a property of a given name.

public HasProperty ( string propertyName ) : bool
propertyName string
return bool
        public bool HasProperty(string propertyName)
        {
            return this.HasProperty(Shader.PropertyToID(propertyName));
        }

Same methods

Material::HasProperty ( int nameID ) : bool

Usage Example

コード例 #1
0
		bool checkSpecUsage(Material mat, string label) {
			if ((label.IndexOf("layer Spec+Gloss")<0) && (label.IndexOf("gloss mask")<0) && (label.IndexOf("Spec (RGB)")<0)) return true;
			if (!mat.HasProperty("_DirectSpec")) return true;
			if (!mat.HasProperty("_IBLSpec")) return true;
			if (mat.GetFloat("_DirectSpec")==0 && mat.GetFloat("_IBLSpec")==0) return false;
			return true;
		}
All Usage Examples Of UnityEngine.Material::HasProperty