Detailed Method Reference

Namespace: Canley.Utility.ColourPicker
Class: CanleyColourController

ConfirmSelection

public void ConfirmSelection()
  • Description: Finalizes the color selection process. This method is typically linked to the “Select” or “OK” button in the UI.
  • Workflow:
    1. Capture: Retrieves the current color from the preview swatch.
    2. Broadcast: Invokes the OnColorFinalized and OnColourConfirmed actions, passing the Color, Hex string, and Color32 data to any listening scripts.
    3. Tactile Feedback: Triggers a MediumBump haptic to provide confirmation of the selection.
    4. Close: Initiates the DelayedClose() routine to shut down the UI panel.
  • Returns: void
  • Example:
// Example of subscribing to the confirmation event
private void Start() 
{
    CanleyColourController.OnColorFinalized += HandleNewColor;
}
 
private void HandleNewColor(Color col) 
{
    Debug.Log("User confirmed color: " + col);
}

TIP

Use this method to trigger the closing of the picker when you want to save the user’s changes. If you need to exit without saving, use CancelSelection() instead.