MaterialNamespace: UnityEngine
Parent class: Object
Description

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).

In order to get the material used by an object, use the Renderer.material property: See Also: Materials, ShaderLab documentation.
renderer.material.color = Color.red;
using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour {
    void Example() {
        renderer.material.color = Color.red;
    }
}
import UnityEngine
import System.Collections

public class Example(MonoBehaviour):

	def Example() as void:
		renderer.material.color = Color.red

Variables
color The main material's color.
mainTexture The material's texture.
mainTextureOffset The texture offset of the main texture.
mainTextureScale The texture scale of the main texture.
passCount How many passes are in this material (Read Only).
renderQueue Render queue of this material.
shader The shader used by the material.
shaderKeywords Additional shader keywords set by this material.
Constructors
Material Create a temporary material from a shader source string.
Functions
CopyPropertiesFromMaterial Copy properties from other material into this material.
DisableKeyword Unset a shader keyword.
EnableKeyword Set a shader keyword that is enabled by this material.
GetColor Get a named color value.
GetFloat Get a named float value.
GetInt Get a named integer value.
GetMatrix Get a named matrix value from the shader.
GetTag Get the value of material's shader tag.
GetTexture Get a named texture.
GetTextureOffset Gets the placement offset of texture propertyName.
GetTextureScale Gets the placement scale of texture propertyName.
GetVector Get a named vector value.
HasProperty Checks if material's shader has a property of a given name.
Lerp Interpolate properties between two materials.
SetBuffer Set a ComputeBuffer value.
SetColor Set a named color value.
SetFloat Set a named float value.
SetInt Set a named integer value.
SetMatrix Set a named matrix for the shader.
SetPass Activate the given pass for rendering.
SetTexture Set a named texture.
SetTextureOffset Sets the placement offset of texture propertyName.
SetTextureScale Sets the placement scale of texture propertyName.
SetVector Set a named vector value.
Inherited members
Variables
hideFlags Should the object be hidden, saved with the scene or modifiable by the user?
name The name of the object.
Functions
GetInstanceID Returns the instance id of the object.
ToString Returns the name of the game object.
Static Functions
Destroy Removes a gameobject, component or asset.
DestroyImmediate Destroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoad Makes the object target not be destroyed automatically when loading a new scene.
FindObjectOfType Returns the first active loaded object of Type type.
FindObjectsOfType Returns a list of all active loaded objects of Type type.
Instantiate Clones the object original and returns the clone.
Operators
bool Does the object exist?
operator != Compares if two objects refer to a different object.
operator == Compares if two objects refer to the same.