Material Material { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Material property of the Mesh class is used to set or retrieve the material associated with a mesh. This material defines the appearance of the mesh when rendered, including its texture, color, and other visual properties.

Usage

To use the Material property, you can assign a Material object to it. This will change the material applied to the mesh, affecting how it is rendered in the scene.

Example

// Example of setting a material to a mesh
Mesh myMesh = new Mesh();
Material myMaterial = new Material();

// Set the material for the mesh
myMesh.Material = myMaterial;

// Retrieve the current material of the mesh
Material currentMaterial = myMesh.Material;