- <SynchroAnimation Duration="10" EndTime="10000" ModelFileName="Lukes box (named).fbx" StartTime="0" SynchroVersion="5.2.2.0" Version="2">
- <Resource Identifier="AA67882D-9AC1-4450-90D1-2C1C7FF8F6BC" Name="Box Side - Growth" NumAnimatedInstances="1">
- <Resource3DRepresentation>
- <Entity3D Identifier="7D972BE6-9B4A-4A86-93C5-4256FB1DCE8F" Name="Basic Wall Wall-Ext_102Bwk-75Ins-100LBlk-12P [294917]">
+ <PreTransform>
<M0>0.003280840348452</M0>
</PreTransform>
+ <PostTransform>
<M0>304.799987792968750</M0>
</PostTransform>
</Entity3D>
</Resource3DRepresentation>
- <ResourceInstance>
- <VisibilityTimeline>
- <VisibilityKeyframe Interpolation="Discrete" Time="0" UseOriginal="false">
<VisibilityValue>0</VisibilityValue>
</VisibilityKeyframe>
- <VisibilityKeyframe Interpolation="Discrete" Time="1822" UseOriginal="false">
<VisibilityValue>100</VisibilityValue>
</VisibilityKeyframe>
</VisibilityTimeline>
- <ColorTimeline>
+ <ColorKeyframe Time="1822" UseOriginal="false">
+ <ColorValue>
<R>0.00</R>
<G>0.00</G>
<B>1.00</B>
</ColorValue>
</ColorKeyframe>
<ColorKeyframe Time="8066" UseOriginal="true" />
</ColorTimeline>
+ <TransformTimeline>
<TransformKeyframe Interpolation="Discrete" Time="1822" UseOriginal="true" />
</TransformTimeline>
</ResourceInstance>
</Resource>
+ <Resource Identifier="11F593C9-5A33-4E24-A41F-7F003404E346" Name="Box Side - Fade In" NumAnimatedInstances="1">
- <Resource3DRepresentation>
+ <Entity3D Identifier="88D87801-2C5D-4F20-BBB9-21566D230A33" Name="Basic Wall
MORE Resco
</SynchroAnimation>
我试图从附加的图像XML文件中获取突出显示的值。我需要在&#34; 3D id&#34;中获取值。因此它可以使用正确的元数据(即:开始时间和日期)附加到统一游戏引擎内的正确游戏对象。
这是我目前的代码,但这是我第一次处理XML文件,所以任何帮助都会受到赞赏。
using UnityEngine;
using System;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Text;
using System.IO;
public class XML : MonoBehaviour
{
public string filepath = "filepath";
public string filename = "filename";
public string filetype = ".xml";
void start()
{
XDocument xDoc = XDocument.Load(filepath + filename + filetype);
var resourceinfo = from rescourse in xDoc.Descendants("Resource")
where rescourse.Attribute("Name").Value == "Growth"
select new
{
Resource = rescourse.Descendants("Resource").Descendants(),
ResourceInstance = rescourse.Descendants("Resource3DRepresentation").Descendants(),
};
foreach (var rescourse in resourceinfo)
{
string name = rescourse.Resource.ElementAt(1).Attribute("Name").Value;
Debug.Log(name);
}
}