- Home /
Question by
Whelly · Mar 07, 2016 at 10:43 AM ·
xmlfile-iostreamingassets
Any change with loading Streaming Assets in Unity 5?
In a previous game, I had a subtitles script that loaded from an XML file in the Streaming Assets folder, and it worked great in Unity 4.6. However, in my new game using 5.3.2, it doesn't seem to be working even though I'm not getting any compiler errors. Could one of you check this code and see if it looks right to you? Any help would be amazing. Thanks so much!
public static void loadFromXML(string file = "Subtitles.xml")
{
string path = Application.streamingAssetsPath;
string fullPath = Path.Combine(path, file);
if (!File.Exists(fullPath)) {
Debug.Log("Could not load file from : " + fullPath);
return;
}
string fileData = File.ReadAllText(fullPath);
XmlDocument root = new XmlDocument();
root.LoadXml(fileData);
Comment
Your code looks fine. Can you add some debug.logs and check if the lines are executed.
Best Answer
Answer by Whelly · Mar 07, 2016 at 05:47 PM
Found out the issue, another script was calling the wrong file string in LoadFromXML... it was totally my fault, sorry for the negligence. You guys got me digging around though, so thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220612070754im_/https://answers.unity.com/themes/thub/images/avi.jpg)