Detailed Method Reference
Namespace: Canley.Utility.ColourPicker
Class: CanleyMiniSwatch
Initialize
public void Initialize(Color col, CanleyColourController controller)- Description: The setup method called immediately after the swatch is spawned. It binds the swatch to a specific color and connects it to the central controller for communication.
- Parameters:
- col: The Unity
Colorthis swatch will represent and store. - controller: A reference to the active
CanleyColourControllerthat this swatch will report to when clicked or deleted.
- col: The Unity
- Workflow:
- Color Assignment: Sets the internal color and updates the
Imagecomponent visuals. - Linkage: Establishes the reference to the controller.
- Visual Validation: Checks if the color is transparent and toggles the alpha-checkerboard background if necessary.
- Color Assignment: Sets the internal color and updates the
- Returns:
void
TIP
If you are building a custom palette loader, ensure you call
Initializeimmediately afterInstantiateto preventNullReferenceExceptionswhen the user interacts with the swatch.