Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class SliderColorSetter : MonoBehaviour
- {
- [SerializeField] private Slider _slider;
- private Image _image;
- private void Awake()
- {
- _image = GetComponent<Image>();
- }
- public void ChangeColor() //Вызывается в событии слайдера OnValueChanged()
- {
- _image.color = Color.Lerp(Color.red, Color.green, _slider.value/ 100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment