How would I attach a script or check a word input against at least 60,000 words?
so for example I type in the code word and it checks if the word is correct according to the list of 60,000+ words?
I’m looking for the fastest optimal code to be able to do this
so if word is run" how do I create a script so it checks this word against the 60k + list?
thanks
code is here just about
using UnityEngine;
using System.Collections;
using UnityEngine.UI; //MAKE SURE YOU HAVE THIS IN YOUR CODE!
public class open : MonoBehaviour {
public string codeWord;
public GameObject inputField;
void Start ()
{
codeWord = "red"; //This is where you set the door code
inputField = GameObject.Find ("InputField"); //This is where you assign the input field object so you can access your inputField component
inputField.GetComponent<InputField>().text = ""; //This makes it so the input field starts with nothing in it.
}
void Update ()
{
if (inputField.GetComponent<InputField>().text == codeWord)
{
if (Input.GetKeyDown(KeyCode.Return)) //So once you've typed the correct code and pressed enter, it will open the door.
{
//Destroy (gameObject, 3); //Open door
}
}
if (inputField.GetComponent<InputField>().text != codeWord)
{
if (Input.GetKeyDown(KeyCode.Return))
{
Destroy (gameObject, 3);//If someone presses enter with the wrong code in the text box, this is where you would make something bad happen to them.
}
}
}
}