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;
- using TMPro;
- public class perc_calc : MonoBehaviour {
- public AudioSource _audio;
- private float length;
- private float CurrentTime;
- public Text DisplayUI;
- public TextMeshProUGUI perc_text;
- // Use this for initialization
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- length = _audio.clip.length;
- CurrentTime = _audio.time;
- DisplayUI.text = ((CurrentTime / length) * 100).ToString("0") + "%";
- perc_text.text = ((CurrentTime / length) * 100).ToString("0") + "%";
- }
- }
Add Comment
Please, Sign In to add comment