GenesisStylization
GenesisStylization wraps the color-grade and stylization band of a Genesis material — hue rotation, posterize, greyscale, and the per-material brightness/contrast/saturation grade. You do not construct it directly; access it through GenesisMaterial.Stylization.
using Genesis.Runtime;
var gm = new GenesisMaterial(GetComponent<Renderer>());
gm.Stylization.SetHueShift(120f); // rotate toward green
gm.Stylization.SetPosterize(6, 1f);
gm.Apply();Hue shift drives a great team-color path: bind from a per-instance MaterialPropertyBlock via the owning GenesisMaterial(Renderer) so every variant batches together. Commit with gm.Apply().
Properties
Methods
Examples
Tint a unit by team color
using Genesis.Runtime;
using UnityEngine;
public class TeamColor : MonoBehaviour
{
[SerializeField] Renderer target;
GenesisMaterial gm;
void Awake() => gm = new GenesisMaterial(target);
void OnDestroy() => gm.Dispose();
public void SetTeam(float hueDegrees)
{
gm.Stylization.SetHueShift(hueDegrees);
gm.Apply();
}
}Drain color to grey on death
public IEnumerator FadeToGrey(GenesisMaterial gm, float duration = 0.6f)
{
for (float t = 0f; t < duration; t += Time.deltaTime)
{
gm.Stylization.GreyscaleAmount = Mathf.Clamp01(t / duration);
gm.Apply();
yield return null;
}
}The grade evaluates in a fixed order (contrast → saturation → gamma → tint). Leaving a parameter at its neutral value disables that pass — but writing every property each frame still buffers writes, so batch them and Apply() once.
See also
Last updated on