Detailed Method Reference
Namespace: Canley.Utility.ColourPicker
Class: CanleyColourController
AddCurrentColorToPalette
public void AddCurrentColorToPalette()-
Description: Takes the currently active color in the picker and saves it to the user’s persistent palette.
-
Workflow:
- Duplicate Check: Compares the current color against existing swatches to prevent redundant entries.
- Instantiation: Spawns a new
CanleyMiniSwatchprefab into the UI container. - Persistence: Updates the
PlayerPrefsdata using the internalSavePalette()logic. - Haptics: Triggers a
DoubleBumpon success or aSoftDoubleBumpif the color already exists.
-
Returns:
void -
Example:
// Wired to a '+' or 'Save' button in the palette UI
colourController.AddCurrentColorToPalette();NOTE
This method requires the
_swatchPrefaband_swatchContainerto be assigned in the Inspector. If they are missing, the method will return early without throwing an error.