Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

MaterialEditor.GetMaterialProperty

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static MaterialProperty GetMaterialProperty(Object[] mats, string name);

Parameters

Parameter Description
mats The materials to get the property for.
name The name of the shader property, for example _Color.

Returns

MaterialProperty The material property with the specified name.

Description

Obtains information about a shader property, identified by name, for a set of materials.

When you implement a custom material editor, pass this.targets to this method to get the property for all the selected materials. The method throws an exception if mats is null or contains a null element.


Declaration

public static MaterialProperty GetMaterialProperty(Object[] mats, int propertyIndex);

Parameters

Parameter Description
mats The materials to get the property for.
propertyIndex The index of the property in the shader.

Returns

MaterialProperty The material property at the specified index.

Description

Obtains information about a shader property, identified by index, for a set of materials.

When you implement a custom material editor, pass this.targets to this method to get the property for all the selected materials. The method throws an exception if mats is null or contains a null element.