Code:
var i:int=0;
var text:String;
var compare:String="";
var isFound:boolean=false;
function Start(){
text=AssetDatabase.LoadAssetAtPath("Assets/words.txt",TextAsset).text;
}
function Update(){
if(!found)
com("textToSearch");
}
function com(s:String){
if(i<text.Length){
comText=comText+text*;*
if(//condition for line break)
if(comText==s){
print(“found”);
found=true;
}
else{
comText=“”;
}
i++;
}
}
In the text document each word ends with a line break. So if I just found a condition for a line break then I can easily search through the document.