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:
- Capture: Retrieves the current color from the preview swatch.
- Broadcast: Invokes the
OnColorFinalizedandOnColourConfirmedactions, passing the Color, Hex string, and Color32 data to any listening scripts. - Tactile Feedback: Triggers a
MediumBumphaptic to provide confirmation of the selection. - 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.