void OnEnable() { MyScore = new ExampleScore { IsSelf = true, Score = UnityEngine.Random.Range(100, 1000), Username = Options.UserName }; HighScores.Add(MyScore); StartCoroutine(NewScoreAsync()); }
IEnumerator NewScoreAsync() { for (int i = 0; i < 100; i++) { if (!enabled) { yield break; } var score = new ExampleScore { IsSelf = false, Score = UnityEngine.Random.Range(100, 1000), Username = Random(DemoNames), }; HighScores.Add(score); yield return(new WaitForSeconds(1)); } }