Material
class in UnityEngine · UnityEngine.CoreModule · inherits from Object
Surface appearance: a shader plus property values. Rendering uses the main color, main texture with its tiling and offset, the alpha cutoff and the render queue; other properties are stored and returned. HasProperty answers per shader, but values are shared between a property's names: URP's _BaseColor/_BaseMap and glTF's baseColorFactor/baseColorTexture/alphaCutoff are the built-in _Color/_MainTex/_Cutoff.
Constructors 1
Properties 11
Color color { get; set; }The main color (_Color, also _BaseColor in URP).
bool doubleSidedGI { get; set; }bool enableInstancing { get; set; }MaterialGlobalIlluminationFlags globalIlluminationFlags { get; set; }How the material's emission takes part in global illumination (none is baked here).
Texture? mainTexture { get; set; }Vector2 mainTextureOffset { get; set; }Vector2 mainTextureScale { get; set; }int passCount { get; }int renderQueue { get; set; }The render queue; -1 (set) means the shader's.
Shader shader { get; set; }string[] shaderKeywords { get; set; }Methods 30
void CopyPropertiesFromMaterial(Material mat)void DisableKeyword(string keyword)void EnableKeyword(string keyword)float GetFloat(int nameID)float GetFloat(string name)float[]? GetFloatArray(string name)float[]? GetFloatArray(int nameID)int GetInt(int nameID)int GetInt(string name)int GetInteger(string name)Matrix4x4 GetMatrix(string name)Matrix4x4 GetMatrix(int nameID)A matrix set on the material; unset ones are the identity.
string GetTag(string tag, bool searchFallbacks, string defaultValue)string GetTag(string tag, bool searchFallbacks)A tag's value: the material's override, else the shader's, else the default.
bool HasProperty(string name)bool HasProperty(int nameID)bool IsKeywordEnabled(string keyword)void SetFloat(int nameID, float value)void SetFloat(string name, float value)void SetFloatArray(string name, float[] values)void SetFloatArray(string name, List<float> values)void SetFloatArray(int nameID, float[] values)void SetFloatArray(int nameID, List<float> values)Array properties: kept on the material (project shaders don't read arrays yet).
void SetInt(int nameID, int value)void SetInt(string name, int value)void SetInteger(string name, int value)void SetOverrideTag(string tag, string val)Overrides a tag of the shader's (RenderType...) for this material.
bool SetPass(int pass)Makes this material the one immediate drawing (GL) uses; true, as for any pass of a supported shader.
Not in Tassix yet 44
ApplyPropertyOverride ComputeCRC CopyMatchingPropertiesFromMaterial FindPass GetBuffer GetColorArray GetConstantBuffer GetFloatArray GetMatrixArray GetPassName GetPropertyNames GetShaderPassEnabled GetTexturePropertyNameIDs GetTexturePropertyNames GetVectorArray HasBuffer HasColor HasConstantBuffer HasFloat HasInt HasInteger HasMatrix HasTexture HasVector IsChildOf IsPropertyLocked IsPropertyLockedByAncestor IsPropertyOverriden Lerp RevertAllPropertyOverrides RevertPropertyOverride SetBuffer SetColorArray SetConstantBuffer SetFloatArray SetKeyword SetMatrixArray SetPropertyLock SetShaderPassEnabled SetVectorArray enabledKeywords isVariant parent rawRenderQueue