diff --git a/Assets/Resources.meta b/Assets/Resources.meta new file mode 100644 index 0000000..89a2f2f --- /dev/null +++ b/Assets/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bcb514437f9c35faaac228c5b6583838 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SpellingBee.meta b/Assets/Resources/SpellingBee.meta similarity index 100% rename from Assets/SpellingBee.meta rename to Assets/Resources/SpellingBee.meta diff --git a/Assets/SpellingBee/images.meta b/Assets/Resources/SpellingBee/images.meta similarity index 100% rename from Assets/SpellingBee/images.meta rename to Assets/Resources/SpellingBee/images.meta diff --git a/Assets/SpellingBee/images/lion.png b/Assets/Resources/SpellingBee/images/lion.png similarity index 100% rename from Assets/SpellingBee/images/lion.png rename to Assets/Resources/SpellingBee/images/lion.png diff --git a/Assets/SpellingBee/images/lion.png.meta b/Assets/Resources/SpellingBee/images/lion.png.meta similarity index 100% rename from Assets/SpellingBee/images/lion.png.meta rename to Assets/Resources/SpellingBee/images/lion.png.meta diff --git a/Assets/SpellingBee/images/monke.png b/Assets/Resources/SpellingBee/images/monke.png similarity index 100% rename from Assets/SpellingBee/images/monke.png rename to Assets/Resources/SpellingBee/images/monke.png diff --git a/Assets/SpellingBee/images/monke.png.meta b/Assets/Resources/SpellingBee/images/monke.png.meta similarity index 100% rename from Assets/SpellingBee/images/monke.png.meta rename to Assets/Resources/SpellingBee/images/monke.png.meta diff --git a/Assets/SpellingBee/words.txt b/Assets/Resources/SpellingBee/words.txt similarity index 100% rename from Assets/SpellingBee/words.txt rename to Assets/Resources/SpellingBee/words.txt diff --git a/Assets/SpellingBee/words.txt.meta b/Assets/Resources/SpellingBee/words.txt.meta similarity index 100% rename from Assets/SpellingBee/words.txt.meta rename to Assets/Resources/SpellingBee/words.txt.meta diff --git a/Assets/Scripts/SpellingBeeController.cs b/Assets/Scripts/SpellingBeeController.cs index 4981420..dc76103 100644 --- a/Assets/Scripts/SpellingBeeController.cs +++ b/Assets/Scripts/SpellingBeeController.cs @@ -5,24 +5,19 @@ using UnityEngine; public class SpellingBeeController : MonoBehaviour { - private List lines; + private string[] words; // Start is called before the first frame update - void Start() { - lines = new List(); - - string path = "Assets/SpellingBee/words.txt"; - StreamReader reader = new StreamReader(path); + void Start() { + TextAsset textFile = Resources.Load("SpellingBee/words"); + string fileContents = textFile.text; - string line = ""; - while ((line = reader.ReadLine()) != null) { - lines.Add(line); - } + words = fileContents.Split('\n'); } // Update is called once per frame void Update() { - int randomIndex = UnityEngine.Random.Range(0, lines.Count); - string randomWord = lines[randomIndex]; + int randomIndex = UnityEngine.Random.Range(0, words.Length - 1); + string randomWord = words[randomIndex]; Debug.Log(randomWord); }