Skip to Content
Material Group: Setup and Tutorial

Learn how to control material and terrain properties with the Material Group editor extension.

Date 27 May 2024
Share
Getting Started

Material groups are contained in a Material System object. First, generate a new material system using the menu bar or right-click “Create” menu:

Assets > Create > Studio Bright > Material Group > Material System

6w Jyf9owpb U3j5 S7

Material Systems can be of two types, “Material,” or “Terrain:”

  • “Material” Systems: Modify a mesh material when groups are changed.
  • “Terrain” Systems: Modify a terrain layer when groups are changed.

Each system has one list of “Slots.” Each slot represents a group of items that will be modified together.

  • Click the [+ Add Slot] button to add new slots:
    • Give each slot a descriptive name.
  • Click [+ New Group] to create a new material group:
    • Give each group a descriptive name.
    • Assign a material or terrain layer to each slot.
Tagging Game Objects
K7yv T Xo Az Ta5 O Gy B

Mesh materials are associated with Material Group system slots using “Material Tag” components.

  • Select a game object that has a mesh or skinned mesh renderer.
  • Click the [Add Component] button, and search for “material tag:”
  • Drag/drop an existing system asset into the Material Group System slot, or use the [New System] button to create a new system:
  • Each material on the renderer will show in a list under “Material Assignment.”

Choose a slot for each material you wish to associate:

Qempx Py Hm47 EH1 Dj
  • Optional: Select a default group and an event specifier to apply a specific group to this object automatically.
  • Material Systems with “Terrain” type are configured in the same way, but associate terrain layers with slots instead of materials.
    • Create terrain layers by adding them to a Terrain asset inspector:
      1. Terrain > Click the Paintbrush > Choose “Paint Texture”
      2. Terrain Layers > Create Layer
  1. New terrain layer asset will be created in the project hierarchy.

(Terrain Layer assets can also be created from the right-click Create menu.)

XMKH26 WG5s QC Gmd T
Changing Groups

Material or Terrain Tags have a method in the component called ApplyGroup, which modifies the current group at run time. A group can be changed by using any of the following:

  1. Group Name (string)
  2. Group Index (number)
  3. Group reference (MaterialGroup object)
Qn Q Dr Sb3r Jd Sr P Oz 1

Material System assets have a list of all MaterialGroup objects (variable name: groups). This list can be parsed by your scripts to manage and change groups as needed.

The sample scenes have examples of scripts that modify material and terrain groups by holding a reference to the Material System asset:

Bj Xzh X3ivuh Vzbgm
Conclusion

We would love to hear from you how this tool helps you achieve goals in your projects!

Please consider reviewing this asset, and reach out to our team with feedback and suggestions:

[email protected]

Learn More