Detailed Method Reference
Namespace: Canley.Utility.ColourPicker
Class: CanleyColourController
OpenPicker
public void OpenPicker()- Description: The primary method to activate the Colour Picker UI. Beyond simply showing the panel, this method performs critical state management:
- State Snapshot: It captures the current color of the picker (the
_startingColor). This allows the CancelSelection method to revert the UI perfectly if the user decides not to proceed. - Theme Synchronization: It triggers
ApplyTheme()to ensure all TextMeshPro elements and button colors match your project’s current aesthetic. - Layout Refresh: It calls
ForceLayoutRebuild()to ensure the UI components (especially the Swatch Container) calculate their sizes correctly before becoming visible.
- State Snapshot: It captures the current color of the picker (the
- Returns:
void - Example:
using UnityEngine;
using Canley.Utility.ColourPicker;
public class MyGameUI : MonoBehaviour
{
[SerializeField] private CanleyColourController _picker;
public void OnEditCharacterColor()
{
// Open the picker and prepare for user interaction
_picker.OpenPicker();
}
}TIP
Always use OpenPicker() instead of manually setting the GameObject to active. By using this method, you ensure the user has a “safety net”�the ability to cancel their changes and return to their original color without you having to write additional state-tracking logic.