Detailed Event Reference

Namespace: Canley.Utility.ColourPicker
Class: CanleyColourController

OnLiveUpdate

public event Action<Color> OnLiveUpdate
  • Description: Fired every time the picker’s color changes via sliders, hex input, or palette selection. This is the primary hook for “Real-time” visual updates in your scene.

  • Workflow:

    1. Trigger: Input is detected (Slider drag, Hex change, or Swatch click).
    2. Synchronization: The internal state updates the UI elements.
    3. Invocation: The event fires, passing the current Color to all subscribed methods.
    4. Safety: Does not fire during internal setup or if the color value remains identical.
  • Parameters:

    • Color: The current color of the picker (RGBA).
  • Example:

// Example: Updating a Light component in real-time
void OnEnable() 
{
    // Subscribe to real-time changes
    picker.OnLiveUpdate += ApplyPreviewColor;
}
 
void OnDisable()
{
    // Unsubscribe to prevent memory leaks
    picker.OnLiveUpdate -= ApplyPreviewColor;
}
 
void ApplyPreviewColor(Color c) 
{
    // Update a light or material instantly
    targetLight.color = c;
}

NOTE

Because this event fires every frame while a slider is being dragged, ensure the subscribed method is high-performance. Avoid heavy operations like GetComponent or Find inside the listener.