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:

    1. Duplicate Check: Compares the current color against existing swatches to prevent redundant entries.
    2. Instantiation: Spawns a new CanleyMiniSwatch prefab into the UI container.
    3. Persistence: Updates the PlayerPrefs data using the internal SavePalette() logic.
    4. Haptics: Triggers a DoubleBump on success or a SoftDoubleBump if the color already exists.
  • Returns: void

  • Example:

// Wired to a '+' or 'Save' button in the palette UI
colourController.AddCurrentColorToPalette();

NOTE

This method requires the _swatchPrefab and _swatchContainer to be assigned in the Inspector. If they are missing, the method will return early without throwing an error.