📡 Event Reference

Namespace: Canley.Utility.ColourPicker
Class: CanleyColourController

Overview

The CanleyColourController uses C# Actions to allow external scripts to “hook into” the picker’s lifecycle. This decoupling ensures your project logic remains clean—allowing you to trigger sounds, update materials, or save data without ever modifying the core picker scripts.


Public Events

Click an event name for detailed information, parameter types, and code examples.

EventTypeDescription
OnLiveUpdateAction<Color>(Instance) Fires every frame the color changes. Best for real-time visual updates.
OnColourConfirmedAction<Color, string, Color32>(Instance) Fires on “Confirm”. Provides the color in three formats for easy saving.
OnColorFinalizedAction<Color>(Static) A global hook. Listen for any picker confirmation without needing a direct reference.
OnPickerClosedAction(Instance) Fires when the UI is hidden, regardless of whether the user confirmed or cancelled.

Implementation Pattern

Most implementations follow this “Subscribe/Unsubscribe” pattern to ensure performance and stability:

void OnEnable() 
{
    // Subscribe when the object is active
    picker.OnLiveUpdate += MyMethod;
}
 
void OnDisable() 
{
    // Unsubscribe when the object is disabled to prevent memory leaks
    picker.OnLiveUpdate -= MyMethod;
}

WARNING

Subscription Hygiene: Always unsubscribe from these events in OnDisable() or OnDestroy(). This is especially critical for Static events like OnColorFinalized, which can persist even after a scene change.


4 items under this folder.