I'm trying to read an already existing xml file with tasks in my game. If I use xmlDoc.Load(Application.dataPath + $"/Resources/XML/tasks1.xml");
then everything works in the editor, but does not work in the finished version on android.
I have read about the possibility of using persistentDataPath
but it does not work. The file is not searched in the editor and on the device. What am I doing wrong?
private void LoadTasks()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Application.persistentDataPath + $"/Resources/XML/Russian/{BurronController.mode}.xml");
XmlNodeList nodes = xmlDoc.DocumentElement.ChildNodes;
XmlNode trueNode = nodes[0];
XmlNode doNode = nodes[1];
trueTasks = new string[trueNode.ChildNodes.Count];
doTasks = new string[doNode.ChildNodes.Count];
for (int i = 0; i < trueTasks.Length; i++)
{
trueTasks[i] = trueNode.ChildNodes[i].InnerText;
}
for (int i = 0; i < doTasks.Length; i++)
{
doTasks[i] = doNode.ChildNodes[i].InnerText;
}
}