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

25 lines
677 B
C#

using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class SpellingBeeController : MonoBehaviour
{
private string[] words;
// Start is called before the first frame update
void Start() {
TextAsset textFile = Resources.Load<TextAsset>("SpellingBee/words");
string fileContents = textFile.text;
words = fileContents.Split('\n');
}
// Update is called once per frame
void Update() {
int randomIndex = UnityEngine.Random.Range(0, words.Length - 1);
string randomWord = words[randomIndex];
Debug.Log(randomWord);
}
}