TemperatureToMaterial
A class in Root.Township, Alta.Heat.
Client: makes metal glow with heat by setting the _ForcedTemperature shader property on its renderers from a heat point's temperature. Does nothing on a headless server.
- Listed in Stats, effects, heat and liquid
- Inherits or implements
MonoBehaviour,IBuildRendererPostBake,IBuildBakeable - Documented in Heat
Constructors
| Member | What it is |
|---|---|
TemperatureToMaterial() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private static readonly int _ForcedTemperature | Shader property ID for _ForcedTemperature. |
private HeatPoint heatPoint | The heat point whose temperature drives the glow. |
private static Logger logger | Class logger, used when a renderer in the list is null. |
private MaterialPropertyBlock props | Property block reused to set the shader value. |
private Renderer[] targetRenderers | Renderers that get the temperature value. |
private AnimationCurve temperatureToValue | Curve from temperature to the 0 to 1 shader value. Default runs from 23 to 1200 degrees. |
Methods
| Member | What it is |
|---|---|
void OnValidate() | Editor: fills in the heat point and, if empty, the renderers that use the Township Tale/MetalNonForging shader. |
3 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Off headless, creates the property block and subscribes to the heat point's Changed event. |
private void IBuildRendererPostBake.PostBake() | Build step: strips null entries from the renderer list. |
private void UpdateValue(HeatPoint heatPoint) | Maps the heat point's temperature through the curve and applies it to every target renderer. |