|
Unity HDRP Product Visualizer 1.0.0
Interactive 3D product showcase built with Unity 6 and HDRP
|
Cycles through brand variants by replacing the full material array on the can renderer. More...


Public Member Functions | |
| void | NextVariant () |
| Advances to the next variant, wrapping around the list. | |
| void | PreviousVariant () |
| Steps back to the previous variant, wrapping around the list. | |
| void | SetVariantIndex (int index) |
| Jumps directly to a variant by index. | |
Public Attributes | |
| Renderer | canRenderer |
| The Renderer whose material array will be swapped. | |
| List< CanVariant > | variants = new() |
| Ordered list of brand variants available in the visualizer. | |
| System.Action< int, CanVariant > | OnVariantChanged |
Fired after a variant change with (newIndex, newVariant). | |
Properties | |
| CanVariant | CurrentVariant [get] |
The currently active CanVariant, or null if the list is empty. | |
| int | CurrentIndex [get] |
| Zero-based index of the active variant. | |
| int | VariantCount [get] |
| Total number of registered variants. | |
| string | CurrentVariantName [get] |
| Display name of the active variant (empty string if none). | |
Cycles through brand variants by replacing the full material array on the can renderer.
The soda can FBX (Resources/Prefabs/Can) exposes exactly two material slots:
| Slot | Region | Changed per variant? |
|---|---|---|
| 0 | Label / body | Yes |
| 1 | Aluminium caps | No (shared) |
_BaseColorMap cannot be overridden per-renderer without creating a material instance anyway. A full swap is simpler and equally performant for a single-object visualizer.Definition at line 49 of file CanMaterialSwapper.cs.
| void CanMaterialSwapper.NextVariant | ( | ) |
Advances to the next variant, wrapping around the list.
Definition at line 97 of file CanMaterialSwapper.cs.
References OnVariantChanged, and variants.
| void CanMaterialSwapper.PreviousVariant | ( | ) |
Steps back to the previous variant, wrapping around the list.
Definition at line 105 of file CanMaterialSwapper.cs.
References OnVariantChanged, and variants.
| void CanMaterialSwapper.SetVariantIndex | ( | int | index | ) |
Jumps directly to a variant by index.
| index | Zero-based index into variants. Out-of-range values are ignored. |
Definition at line 114 of file CanMaterialSwapper.cs.
References OnVariantChanged, and variants.
| Renderer CanMaterialSwapper.canRenderer |
The Renderer whose material array will be swapped.
Auto-detected via GetComponentInChildren if left null.
Definition at line 58 of file CanMaterialSwapper.cs.
| System.Action<int, CanVariant> CanMaterialSwapper.OnVariantChanged |
Fired after a variant change with (newIndex, newVariant).
Subscribe in VisualizerUI to update on-screen labels.
Definition at line 72 of file CanMaterialSwapper.cs.
Referenced by NextVariant(), PreviousVariant(), and SetVariantIndex().
| List<CanVariant> CanMaterialSwapper.variants = new() |
Ordered list of brand variants available in the visualizer.
Populated automatically by ProductVisualizerSetup from the textures found in Assets/Resources/textures/.
Definition at line 64 of file CanMaterialSwapper.cs.
Referenced by NextVariant(), PreviousVariant(), and SetVariantIndex().
|
get |
Zero-based index of the active variant.
Definition at line 126 of file CanMaterialSwapper.cs.
|
get |
The currently active CanVariant, or null if the list is empty.
Definition at line 123 of file CanMaterialSwapper.cs.
|
get |
Display name of the active variant (empty string if none).
Definition at line 132 of file CanMaterialSwapper.cs.
|
get |
Total number of registered variants.
Definition at line 129 of file CanMaterialSwapper.cs.