比如到UnityAssetStore买了一个PolygonCity的asset资源,打开里面的Demo.scene。
用这个C#脚本可以导出xml,
脚本参考了《Unity3D研究院之将场景导出XML或JSON或二进制并且解析还原场景(四十二)》http://www.xuanyusong.com/archives/1919
!!!会对场景对象的树形结构进行修改,注意备份。
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.Collections.Generic;
using System.Xml;
using System.IO;
using System.Text;
public class MyEditor : Editor
{
//将所有游戏场景导出为XML格式
[MenuItem ("GameObject/cake")]
static void ExportXML ()
{
string filepath = Application.dataPath + @"/StreamingAssets/my.xml";
if(!File.Exists (filepath))
{
File.Delete(filepath);
}
XmlDocument xmlDoc = new XmlDocument();
XmlElement root = xmlDoc.CreateElement("gameObjectsrt");
//遍历所有的游戏场景
foreach (GameObject xx i