Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

How to save a list to make it application persistent?

I have this codes to save and load my list

`
public void Save(List list)
{
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Create(Application.persistentDataPath + "/objectlist.dat");

    ListData data = new ListData();
    data.objectList = list;

    bf.Serialize(file, data);
    file.Close();
}

/// <summary>
/// loads a serialized data, checks first if data exists
/// </summary>
public void Load()
{
    if (File.Exists(Application.persistentDataPath + "/objectlist.dat"))
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/objectlist.data", FileMode.Open);
        ListData data = (ListData)bf.Deserialize(file);
        file.Close();

        objList = data.objectList;
    }
}

`

i also have
[Serializable] class ListData { public List<GameObject> objectList; }

When i simulate in unity, I have this error:
SerializationException: Type UnityEngine.GameObject is not marked as Serializable. IOException: Sharing violation on path C:\Users\DataMesh\AppData\LocalLow\DataMesh\EngineView\objectlist.dat

What am I doing wrong here?
This is the first time I do this and I can't really figure out.

Sign In or Register to comment.