1using System.Collections.Generic;
22 public Color
topColor =
new(0.06f, 0.06f, 0.18f, 1f);
62 [Header(
"References")]
72 public List<BackgroundPreset>
presets =
new();
85 private int _currentIndex;
86 private MaterialPropertyBlock _mpb;
92 void Awake() => _mpb =
new MaterialPropertyBlock();
96 if (
presets.Count > 0) Apply(0);
106 _currentIndex = (_currentIndex + 1) %
presets.Count;
107 Apply(_currentIndex);
115 if (index < 0 || index >=
presets.Count)
return;
116 _currentIndex = index;
136 void Apply(
int index)
143 _mpb.SetColor(
"_TopColor", p.
topColor);
145 _mpb.SetFloat(
"_VignetteAmount", p.
vignette);
Cycles through BackgroundPreset entries by writing to MaterialPropertyBlocks.
string CurrentPresetName
Display name of the active preset (empty string if none).
BackgroundPreset CurrentPreset
The currently active BackgroundPreset, or null if the list is empty.
void SetPreset(int index)
Jumps directly to a preset by index.
System.Action< int, BackgroundPreset > OnPresetChanged
Fired after a preset change with (newIndex, newPreset).
Renderer backdropRenderer
Renderer of the large backdrop quad (uses GradientBackground shader).
List< BackgroundPreset > presets
Ordered list of available studio presets.
Renderer groundRenderer
Renderer of the ground plane quad (uses HDRP/Lit).
int CurrentIndex
Zero-based index of the active preset.
void NextPreset()
Advances to the next preset, wrapping around the list.
Serialisable data record that defines one studio backdrop look.
Color bottomColor
Bottom gradient colour fed into _BottomColor.
float vignette
Radial vignette intensity fed into _VignetteAmount (0 = off, 4 = heavy).
string presetName
Human-readable name shown in the on-screen UI (e.g. "Dark Studio").
Color groundTint
Tint applied to the ground plane's _BaseColor.
Color topColor
Top gradient colour fed into the GradientBackground shader's _TopColor.