string MaterialGroup { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The MaterialGroup property of the ModelRenderer class specifies the material group to be used for rendering the model. This property is a string that identifies a specific group of materials that can be applied to the model, allowing for different visual appearances based on the selected group.

This property is decorated with several attributes:

  • PropertyAttribute: Marks this property as a configurable property within the editor.
  • MaterialGroupAttribute: Indicates that this property is related to material groups.
  • MakeDirtyAttribute: Ensures that changes to this property mark the object as needing to be re-rendered.
  • ShowIfAttribute: Conditionally shows this property in the editor if the HasMaterialGroups condition is met.
  • DefaultValueAttribute: Specifies a default value for this property.

Usage

To use the MaterialGroup property, simply assign a string value that corresponds to the desired material group. This will change the appearance of the model based on the materials defined in that group.

Ensure that the model has material groups defined, and that the HasMaterialGroups property is true, to make use of this feature.

Example

// Example of setting the MaterialGroup property
ModelRenderer modelRenderer = new ModelRenderer();
modelRenderer.MaterialGroup = "GroupName"; // Set the material group to "GroupName"