So lately I have been trying to create a script to read .txt files and split it into chunks for NPCs and dialogue. Except, I have run into a problem, when I try to see if something from the text file is equal to a piece of text in the script, they never are, when even they should be. Are there hidden spaces or something when a .txt file is turned into a string? Here is an example of what I’m am trying to say.
var textFile : TextAsset;
var DialogLines : String[];
function Start(){
if(textFile){
DialogLines = (textFile.text.Split("
"[0]));
}
}
function Update(){
if(DialogLines[0] == "TheTextToFind"){
print("Found it");
}
}
In this case, the first column in the text file would be “TheTextToFind”, and yet it never works.It seems like it should be simple enough, but it doesn’t work at all, and I can never locate anything/find anything. (I am sure that there is not mistake in the text file/word being used to search, I have tried searching for many things, coming up with nothing)
Any help is greatly appreciated!