Tanoda
HSVPicker/UI/ColorImage.cs
Go to the documentation of this file.
1using UnityEngine;
2using UnityEngine.UI;
3
4[RequireComponent(typeof(Image))]
5public class ColorImage : MonoBehaviour
6{
8
9 private Image image;
10
11 private void Awake()
12 {
13 image = GetComponent<Image>();
14 picker.onValueChanged.AddListener(ColorChanged);
15 }
16
17 private void OnDestroy()
18 {
19 picker.onValueChanged.RemoveListener(ColorChanged);
20 }
21
22 private void ColorChanged(Color newColor)
23 {
24 image.color = newColor;
25 }
26}
System.Drawing.Image Image
Definition: TestScript.cs:37
UnityEngine.Color Color
Definition: TestScript.cs:32
ColorPicker picker
ColorChangedEvent onValueChanged
Definition: ColorPicker.cs:19