- Home /
Load XML into TextAsset without Resources.Load() - Build problem
Hey guys,
i need to find a way to realize the XML loading without using the Resources.Load() function. Or maybe another solution..
Right now i am copying a xml file into the Resources Folder, call AssetDatabase.Refresh() in order to make the file immediately available for processing. Basically my Game initiation is based on the information in this file.
The problem is that AssetDatabase is using UnityEdior, and even though there are workarounds, i cannot build the game.
So the perfect solution would be if i could load the file directly into the TextAsset.
Thanks in advance.
Answer by moocho · Sep 01, 2014 at 05:28 PM
Totally forgot the question, it is solved, and it was quite apparent... here how i solved it, in case anybody else can use it someday.
XmlDocument xmlDoc = new XmlDocument();
string xml = File.ReadAllText(filePath);
xmlDoc.LoadXml(xml);
// do what you wanna do
...