Files
unity-application/Assets/Scripts/SpellingBeeController.cs
2023-02-28 12:24:46 +01:00

30 lines
783 B
C#

using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class SpellingBeeController : MonoBehaviour
{
private List<string> lines;
// Start is called before the first frame update
void Start() {
lines = new List<string>();
string path = "Assets/SpellingBee/words.txt";
StreamReader reader = new StreamReader(path);
string line = "";
while ((line = reader.ReadLine()) != null) {
lines.Add(line);
}
}
// Update is called once per frame
void Update() {
int randomIndex = UnityEngine.Random.Range(0, lines.Count);
string randomWord = lines[randomIndex];
Debug.Log(randomWord);
}
}