unity实现安卓手机读xml方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/a673544319/article/details/81508223

直接上代码

        string path = string.Empty;
        WWW www;
        if (Application.platform == RuntimePlatform.Android) {
            path = Application.streamingAssetsPath + "/AppInfo.xml"; 
        } else {
            path = "file://" + Application.streamingAssetsPath + "/AppInfo.xml";
        }

        www = new WWW(path);
        yield return www;

        XDocument xDoc = XDocument.Parse(www.text);
        XElement root = xDoc.Root;

猜你喜欢

转载自blog.csdn.net/a673544319/article/details/81508223