Material
extends AssetObject
The Material class is used to control the appearance and material of a rendered object. Each rendered object can be associated with a Material object, which determines its appearance and behavior in the scene.
You can obtain a Material object using the following method:
typescript
let shader = Shader.Find("Resouses/Shader/Diffuse"); // Load the shader
let material = new Material(shader);Constructors
Material.new ( shader : Shader , handle : IntPtr? ) |
Instance Properties
Material.shader : Shader |
| The shader used by the material. |
Material.renderQueue : number |
| The rendering queue of the current material. |
Instance Method
Material.HasFloat ( name : string ) : boolean |
| Check if the current material has a Float property with the specified name. |
Material.GetFloat ( name : string , out_result : number ) : number|undefined |
| Get the Float value of a specific float property of the current material based on the property name. |
Material.HasColor ( name : string ) : boolean |
| Check if the current material has a Color property with the specified name. |
Material.GetVector ( name : string ) : Vector4|undefined |
| Get the Vector value of a material based on the property name. |
Material.GetTexture ( name : string ) : Texture|null |
| Get the Texture value of a specified property name. |
Material.GetMatrix4x4 ( name : string ) : Matrix4x4|undefined |
| Get the value of a Matrix4x4 property from the current shader used by the material. |
Material.HasVector ( name : string ) : boolean |
| Check if the current material has a Vector property with the given name. |
Material.GetColor ( name : string ) : Color|undefined |
| Get the Color value of the current material based on the property name. |
Material.SetVector ( name : string , value : Vector4 ) : void |
| Set the Vector value of a material based on the property name. |
Material.SetTexture ( name : string , tex : Texture ) : void |
| Set the Texture value of a material based on the property name. |
Material.HasMatrix4x4 ( name : string ) : boolean |
| Checks if the current material's shader has a Matrix4x4 property with the specified name. |
Material.HasTexture ( name : string ) : boolean |
| Check if the current material has a Texture property. |
Material.SetFloat ( name : string , value : number ) : void |
| Set the Float value of the current material. |
Material.SetColor ( name : string , value : Color ) : void |
| Set the Color value of a material based on the property name. |
Material.SetMatrix4x4 ( name : string , value : Matrix4x4 ) : void |
| Set the value of the Matrix4x4 property in the current material shader. |
Material.IsKeywordEnabled ( value : string ) : boolean |
| Checks if the specified shader keyword is enabled for this material. |
Material.DisableKeyword ( value : string ) : void |
| Disables the local shader keyword for this material. |
Material.EnableKeyword ( value : string ) : void |
| Enables the local shader keyword for this material. |
