1using System.Collections.Generic;
57 [Header(
"Can Renderer")]
63 [Header(
"Variants (one per brand)")]
78 private int _currentIndex;
99 _currentIndex = (_currentIndex + 1) %
variants.Count;
100 Apply(_currentIndex);
108 Apply(_currentIndex);
116 if (index < 0 || index >=
variants.Count)
return;
117 _currentIndex = index;
140 void Apply(
int index)
144 canRenderer.materials =
new[] { v.
labelMaterial, v.capMaterial };
Cycles through brand variants by replacing the full material array on the can renderer.
void PreviousVariant()
Steps back to the previous variant, wrapping around the list.
void SetVariantIndex(int index)
Jumps directly to a variant by index.
int VariantCount
Total number of registered variants.
string CurrentVariantName
Display name of the active variant (empty string if none).
void NextVariant()
Advances to the next variant, wrapping around the list.
Renderer canRenderer
The Renderer whose material array will be swapped.
int CurrentIndex
Zero-based index of the active variant.
List< CanVariant > variants
Ordered list of brand variants available in the visualizer.
System.Action< int, CanVariant > OnVariantChanged
Fired after a variant change with (newIndex, newVariant).
CanVariant CurrentVariant
The currently active CanVariant, or null if the list is empty.
Data container that pairs a brand label material with an aluminium cap material.
string variantName
Human-readable brand name shown in the on-screen UI.
Material labelMaterial
HDRP/Lit material applied to slot 0 (the printable label area).
Material capMaterial
HDRP/Lit material applied to slot 1 (the aluminium top and bottom caps).