What I am trying to do is to read the xml file from an url which is my github repo via raw file in Unity and add it to my arrayList with class as the datatype. However, everything works well on Unity but when it's on the browser, the game will freeze when loading the scene that the script is in. On my Chrome inspects, it showed an error called, 2 FS.syncfs operations in flight at once, probably just doing extra work. I also noticed that my browser CPU usage is at maximum when the game is trying to load the scene.
Here is my code for reading the xml file and adding it to my arrayList. On the void Start()
method, I will StartCoroutine(ReadXML("xxxxxxx"));
.
IEnumerator ReadXML(string url)
{
try
{
xmldoc = XDocument.Load(@url);
var query = from p in xmldoc.Elements("popupNotify").Elements("popNoti")
select p;
foreach (XElement record in query)
{
PopNotifi popNoti = new(record.Element("text").Value,
record.Element("colliderName").Value, record.Element("type").Value, record.Element("duration").Value);
popNotifiList.Add(popNoti);
}
} catch (Exception e)
{
Debug.LogError(e.Message);
}
yield return url;
}