How to use a Slider to update a Text using UI?

I am trying to have the Text update to the max Value of a Slider! so when the slider is all the way to 100 there will be a text that shows it is at 100 or 18 and etc. Any Ideas? I already have my slider working but just not to text.

You can set a function to be called when the slider value changes, and that function can take the value from the slider and set a text to that same value. Also, the slider value goes from 0 to 1, so you have to multiply it by 100 for the result you want.

Add this script as a component on the Text game object:

using UnityEngine;
using UnityEngine.UI;

public class SliderText : MonoBehaviour {

	Text textComponent;

	void Start() {
		textComponent = GetComponent<Text>();

	public void SetSliderValue(float sliderValue) {
		textComponent.text = Mathf.Round(sliderValue * 100).ToString();

Then select the Slider and look at the bottom of the Slider component. You can add entries to that “On value changed” section. Just add a new function, drag and drop the Text game object and select the SliderText.SetSliderValue function on the “Dynamic floats” section.

Eh, like

public Text sliderValue;
public Slider slider;

void Update(){

sliderValue.text = slider.value.ToString("0.0");



@DiegoSLTS how to update int using slider? i want it to change the value of my slider(in the inspector) not in the code. thanks.

using System.Collections;
using UnityEngine;
using UnityEngine.UI;

public class MeterManager : MonoBehaviour
	public Button[] buttons;
	bool GameOver;
	int meter;

	public Slider meterSlider;
	public uimanager ui;
	public GameObject MC, Text, Ok;
	private carcontroller car;
	// Use this for initialization
	void Start()
		MC.SetActive (false);
		Text.SetActive (false);
		Ok.SetActive (false);
		car = FindObjectOfType<carcontroller> ();
		GameOver = false;
		meter = 0;
		InvokeRepeating("meterUpdate", 1f, 1f);

	// Update is called once per frame
	void Update()
		meterSlider.value = meter;

		if (meterSlider.value >= 10)
			gamecontroller.MoneyAmount = 120;
			Destroy (car);
			Time.timeScale = 0;
			MC.SetActive (true);
			Text.SetActive (true);
			Ok.SetActive (true);

	void meterUpdate()
		if (GameOver == false)
			meter += 1;


	public void Gamestart() {
		GameOver = true;
		foreach(Button button in buttons)       {