Class MaterialSwapperRandomizerTag
Randomizes the target material of an object when used in conjunction with MaterialSwapperRandomizer.
Inheritance
MaterialSwapperRandomizerTag
Inherited Members
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Namespace: UnityEngine.Perception.Randomization.Randomizers
Assembly: Unity.Perception.Runtime.dll
Syntax
[AddComponentMenu("Perception/RandomizerTags/Material Swapper Tag")]
[MovedFrom("UnityEngine.Perception.Internal")]
[RequireComponent(typeof(Renderer))]
public class MaterialSwapperRandomizerTag : RandomizerTag
Fields
materials
The list of materials from which the target material will be replaced
Declaration
[Tooltip("Randomly chooses a material from the options provided and assigns it to the submesh/material element specified above. The probability of each material being selected can be modified by disabling the Uniform flag and providing probability values manually.")]
public CategoricalParameter<Material> materials
Field Value
Type | Description |
---|---|
CategoricalParameter<Material> |
targetedMaterialIndex
The index of the target material element (i.e. material tied to a submesh)
Declaration
[Tooltip("The material element which will be randomized from the options below.")]
public int targetedMaterialIndex
Field Value
Type | Description |
---|---|
int |
Properties
Renderer
The Renderer component attached to the GameObject which has the MaterialSwapperRandomizerTag.
Declaration
public Renderer Renderer { get; }
Property Value
Type | Description |
---|---|
Renderer |
Methods
Randomize()
For the selected material element (whose index in the materials array is given by targetedMaterialIndex), sample a material from materials and set it as the above material element's material.
Declaration
public void Randomize()