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:
- Trigger: Input is detected (Slider drag, Hex change, or Swatch click).
- Synchronization: The internal state updates the UI elements.
- Invocation: The event fires, passing the current
Colorto all subscribed methods. - 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
GetComponentorFindinside the listener.