public string OpenDialogueFile(string dialogueName) {
if(dialogues == null) {
dialogues = Resources.LoadAll<TextAsset>("Dialogue");
}
var text = "";
foreach(var ta in dialogues) {
print(ta.name + ".." + dialogueName);
if(ta.name == dialogueName) {
print("Found");
text = ta.text;
break;
}
}
return text;
}
This code should find a plain text file with the name requested and spit out the contents.
With the files "test1 and test2" in Resources/Dialogue
and requesting test1, the output is
test1..test1
Found
When test2 is requested, however
test1..test2
test2..test2
The program claims that test2 is unequal to test2.
Both ta.name and dialogueName are strings, so it should be testing equality by content.
Is there something wrong with my equality operation?