Answers for "slider script unity"

C#
0

slider script unity

using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class SliderScript : MonoBehaviour
{
    [SerializeField] private Slider slider; //attach slider here
    [SerializeField] private TextMeshProUGUI sliderNumber; //attach TextMeshProText here

    private void Start()
    {
        slider.onValueChanged.AddListener((value) =>
        {
            sliderNumber.text = value.ToString("0");
        });
    }
}
Posted by: Guest on October-06-2021

C# Answers by Framework

Browse Popular Code Answers by Language