k.tian
k.tian

Reputation: 1

How to save ADF file in Unity

In the Unity demo,how to save the ADF file?

I don't know if the AreaDesription.SaveCurrent() function use for do it and I don't know why the following code's position and rotation data is specified not get runtime.

using

(StreamWriter streamWriter = 
       new StreamWriter(File.Open(EMULATED_ADF_SAVE_PATH + uuid + EMULATED_ADF_EXTENSION,
                                  FileMode.Create)))
{
    Metadata metadata = new Metadata();
    metadata.m_name = "Unnamed";
    metadata.m_dateTime = DateTime.Now;
    metadata.m_transformationPosition = new double[3];
    metadata.m_transformationRotation = new double[] { 0, 0, 0, 1 };
    metadataXmlSerializer.Serialize(streamWriter, metadata);
}

Upvotes: 0

Views: 361

Answers (1)

Jethro
Jethro

Reputation: 3329

There is a Unity Example here (AreaDescriptionManagement) which shows a full example of Saving Area Descriptions, and also editing them etc...
I'd recommend running that example, and then ripping out the bits you want.

Upvotes: 1

Related Questions