Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- public class ColorPicker : MonoBehaviour {
- public Slider R, G, B;
- public Image Sampler;
- public Material Target;
- public GameObject ButButton;
- private Color old_color;
- void FixedUpdate () {
- Color c = new Color(R.value, G.value, B.value);
- Sampler.color = c;
- Target.SetColor("_Color", c);
- }
- void OnDisable()
- {
- Sampler.color = old_color;
- Target.SetColor("_Color", old_color);
- }
- void OnEnable()
- {
- old_color = Target.color;
- R.value = old_color.r;
- G.value = old_color.g;
- B.value = old_color.b;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement