Skip to main content

Material

info

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

NameDescription
Material.colorThe main color of the Material.
Material.doubleSidedGIGets and sets whether the Double Sided Global Illumination setting is enabled for this material.
Material.enableInstancingGets and sets whether GPU instancing is enabled for this material.
Material.globalIlluminationFlagsDefines how the material should interact with lightmaps and lightprobes.
Material.mainTextureThe main texture.
Material.mainTextureOffsetThe offset of the main texture.
Material.mainTextureScaleThe scale of the main texture.
Material.passCountHow many passes are in this material (Read Only).
Material.renderQueueRender queue of this material.
Material.shaderKeywordsAn array containing the names of the local shader keywords that are currently enabled for this material.

Methods

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

Inherited Members

Inherited Properties

NameDescription
Material.hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
Material.nameThe name of the object.

Inherited Methods

NameDescription
Material.GetInstanceID()Returns the instance id of the object.