Skip to content

API > Material


Material⚓︎

Material inherits from Object

The material class. This class exposes all properties from a material, allowing you to animate them. You can also use it to set custom shader properties that can't be accessed through the inspector (e.g. matrices). Unity Material

Members⚓︎

Properties⚓︎

Name Description
Material.colorProperty The main color of the Material.
Material.doubleSidedGIProperty Gets and sets whether the Double Sided Global Illumination setting is enabled for this material.
Material.enableInstancingProperty Gets and sets whether GPU instancing is enabled for this material.
Material.globalIlluminationFlagsProperty Defines how the material should interact with lightmaps and lightprobes.
Material.mainTextureProperty The main texture.
Material.mainTextureOffsetProperty The offset of the main texture.
Material.mainTextureScaleProperty The scale of the main texture.
Material.passCountProperty How many passes are in this material (Read Only).
Material.renderQueueProperty Render queue of this material.
Material.shaderKeywordsProperty An array containing the names of the local shader keywords that are currently enabled for this material.

Methods⚓︎

Name Description
Material.ComputeCRC() Method Computes a CRC hash value from the content of the material.
Material.CopyPropertiesFromMaterial(mat) Method Copy properties from other material into this material.
Material.DisableKeyword(keyword) Method Disables a local shader keyword for this material.
Material.EnableKeyword(keyword) Method Enables a local shader keyword for this material.
Material.FindPass(passName) Method Returns the index of the pass passName.
Material.GetColor(name) Method Get a named color value.
Material.GetColor(nameID) Method Get a named color value.
Material.GetColorArray(name) Method Get a named color array.
Material.GetFloat(name) Method Get a named float value.
Material.GetFloatArray(name) Method Get a named float array.
Material.GetInt(name) Method Get a named integer value.
Material.GetMatrix(name) Method Get a named matrix value from the shader.
Material.GetMatrixArray(name) Method Get a named matrix array.
Material.GetPassName(pass) Method Returns the name of the shader pass at index pass.
Material.GetShaderPassEnabled(passName) Method Checks whether a given Shader pass is enabled on this Material.
Material.GetTag(tag, searchFallbacks) Method Get the value of material's shader tag.
Material.GetTag(tag, searchFallbacks, defaultValue) Method Get the value of material's shader tag.
Material.GetTexture(name) Method Get a named texture.
Material.GetTextureOffset(name) Method Gets the placement offset of texture propertyName.
Material.GetTexturePropertyNameIDs() Method Return the name IDs of all texture properties exposed on this material.
Material.GetTexturePropertyNames() Method Returns the names of all texture properties exposed on this material.
Material.GetTextureScale(name) Method Gets the placement scale of texture propertyName.
Material.GetVector(name) Method Get a named vector value.
Material.GetVectorArray(name) Method Get a named vector array.
Material.HasProperty(name) Method Checks if material's shader has a property of a given name.
Material.IsKeywordEnabled(keyword) Method Checks whether a local shader keyword is enabled for this material.
Material.Lerp(start, end, t ) Method Interpolate properties between two materials.
Material.SetColor(name, value) Method Sets a named color value.
Material.SetColorArray(name, values[]) Method Sets a color array property.
Material.SetFloat(name, value) Method Sets a named float value.
Material.SetFloatArray(name, values[]) Method Sets a float array property.
Material.SetInt(name, value) Method Sets a named integer value.
Material.SetMatrix(name, value) Method Sets a named matrix for the shader.
Material.SetMatrixArray(name, values[]) Method Sets a matrix array property.
Material.SetOverrideTag(tag, val) Method Sets an override tag/value on the material.
Material.SetPass(pass) Method Activate the given pass for rendering.
Material.SetShaderPassEnabled(passName, enabled) Method Enables or disables a Shader pass on a per-Material level.
Material.SetTexture(name, value) Method Sets a named texture.
Material.SetTextureOffset(name, value) Method Sets the placement offset of texture propertyName.
Material.SetTextureScale(name, value) Method Sets the placement scale of texture propertyName.
Material.SetVector(name, value) Method Sets a named vector value.
Material.SetVectorArray(name, values[]) Method Sets a vector array property.

Inherited Members⚓︎

Inherited Properties⚓︎

Name Description
Material.hideFlagsProperty Should the object be hidden, saved with the Scene or modifiable by the user?
Material.nameProperty The name of the object.

Inherited Methods⚓︎

Name Description
Material.GetInstanceID()Method Returns the instance id of the object.