I know how to create a timer and put it in a text but have can I put the value of timer in the slider?any idea?
Try this:
public RawImage yourSlider; // set RectTransform Anchors min, max and pivot X to 0
public float widht;
public float totalTime = 120; // 2 min
public float actualTime; // the current time, you can set it each frame
private void Start()
{
widht = yourSlider.rectTransform.rect.width;
}
private void Update()
{
// actualTime = current time
yourSlider.rectTransform.sizeDelta = new Vector2((widht / totalTime) * actualTime, yourSlider.rectTransform.sizeDelta.y);
}