Bug Fix in Text Animation Script

This commit is contained in:
Philip W 2021-11-14 12:11:16 +00:00
parent 68d2750ff1
commit 79eaa64ccf

View File

@ -6,25 +6,26 @@ using UnityEngine.UI;
public class FetchingScoresAnimation : MonoBehaviour public class FetchingScoresAnimation : MonoBehaviour
{ {
private Text textComponent;
void Update() void Start()
{ {
textComponent = GetComponent<Text>();
AnimateText(); AnimateText();
} }
private async void AnimateText() private async void AnimateText()
{ {
Text text = GetComponent<Text>();
while (true) while (true)
{ {
await Task.Run(async () => { textComponent.text = "Fetching Scores";
text.text = "Fetching Scores.";
await Task.Delay(1000); await Task.Delay(1000);
text.text = "Fetching Scores.."; textComponent.text = "Fetching Scores.";
await Task.Delay(1000); await Task.Delay(1000);
text.text = "Fetching Scores..."; textComponent.text = "Fetching Scores..";
await Task.Delay(1000);
textComponent.text = "Fetching Scores...";
await Task.Delay(1000); await Task.Delay(1000);
});
} }
} }
} }