Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (23 sloc) 685 Bytes
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Xml;
public static class LoadXML {
public static XmlDocument LoadLocalFile(string filePath)
{
XmlDocument document = new XmlDocument();
TextAsset resourceFile = Resources.Load(filePath) as TextAsset;
if (!resourceFile)
throw new XmlException("Failed to load file.");
try
{
document.LoadXml(resourceFile.text);
return document;
}
catch(Exception exception)
{
throw new Exception("Failed to load xml file. " + exception);
}
}
}
You can’t perform that action at this time.