Unity HDRP Product Visualizer 1.0.0
Interactive 3D product showcase built with Unity 6 and HDRP
Loading...
Searching...
No Matches
BackgroundController Class Reference

Cycles through BackgroundPreset entries by writing to MaterialPropertyBlocks. More...

Inheritance diagram for BackgroundController:
Collaboration diagram for BackgroundController:

Public Member Functions

void NextPreset ()
 Advances to the next preset, wrapping around the list.
 
void SetPreset (int index)
 Jumps directly to a preset by index.
 

Public Attributes

List< BackgroundPresetpresets = new()
 Ordered list of available studio presets.
 
System.Action< int, BackgroundPresetOnPresetChanged
 Fired after a preset change with (newIndex, newPreset).
 
References
Renderer backdropRenderer
 Renderer of the large backdrop quad (uses GradientBackground shader).
 
Renderer groundRenderer
 Renderer of the ground plane quad (uses HDRP/Lit).
 

Properties

BackgroundPreset CurrentPreset [get]
 The currently active BackgroundPreset, or null if the list is empty.
 
int CurrentIndex [get]
 Zero-based index of the active preset.
 
string CurrentPresetName [get]
 Display name of the active preset (empty string if none).
 

Detailed Description

Cycles through BackgroundPreset entries by writing to MaterialPropertyBlocks.

Using MaterialPropertyBlock means the shared Material assets are never modified, so changes are not serialised to disk and do not break prefabs.

Scene wiring
ProductVisualizerSetup assigns backdropRenderer and groundRenderer automatically. Add further presets in the Inspector at any time; they become available immediately in Play mode.
Preset list (defaults)
# Name Mood
0 Dark Studio Classic product render
1 Warm Amber Cozy / sunset
2 Deep Space Dark sci-fi
3 Emerald Night Nature / energy drink

Definition at line 52 of file BackgroundController.cs.

Member Function Documentation

◆ NextPreset()

void BackgroundController.NextPreset ( )

Advances to the next preset, wrapping around the list.

Definition at line 104 of file BackgroundController.cs.

References OnPresetChanged, and presets.

◆ SetPreset()

void BackgroundController.SetPreset ( int  index)

Jumps directly to a preset by index.

Parameters
indexZero-based index into presets. Out-of-range values are ignored.

Definition at line 113 of file BackgroundController.cs.

References OnPresetChanged, and presets.

Member Data Documentation

◆ backdropRenderer

Renderer BackgroundController.backdropRenderer

Renderer of the large backdrop quad (uses GradientBackground shader).

Definition at line 63 of file BackgroundController.cs.

◆ groundRenderer

Renderer BackgroundController.groundRenderer

Renderer of the ground plane quad (uses HDRP/Lit).

Definition at line 66 of file BackgroundController.cs.

◆ OnPresetChanged

System.Action<int, BackgroundPreset> BackgroundController.OnPresetChanged

Fired after a preset change with (newIndex, newPreset).

Definition at line 79 of file BackgroundController.cs.

Referenced by NextPreset(), and SetPreset().

◆ presets

List<BackgroundPreset> BackgroundController.presets = new()

Ordered list of available studio presets.

Definition at line 72 of file BackgroundController.cs.

Referenced by NextPreset(), and SetPreset().

Property Documentation

◆ CurrentIndex

int BackgroundController.CurrentIndex
get

Zero-based index of the active preset.

Definition at line 125 of file BackgroundController.cs.

◆ CurrentPreset

BackgroundPreset BackgroundController.CurrentPreset
get

The currently active BackgroundPreset, or null if the list is empty.

Definition at line 122 of file BackgroundController.cs.

◆ CurrentPresetName

string BackgroundController.CurrentPresetName
get

Display name of the active preset (empty string if none).

Definition at line 128 of file BackgroundController.cs.


The documentation for this class was generated from the following file: