- Home /
Question by
boddole · Mar 05, 2016 at 03:53 PM ·
serializationdata storageserializeserializable
Saving Non-Prefab Data During Editor Play
I've been looking into how I could save specific changes made to non-prefab data from Editor Play sessions (Unity version 4.7). I thought I had my head around it, but that doesn't seem to be the case. Below I've got a serialized struct and a serialized field from another class where I use a List of those structs. It works for saving data from Editor->Play, but not the other way around:
[System.Serializable]
public struct AdditionalNodeData {
public AdditionalNodeData (int indexOfNode, uint tagValue)
{
nodeIndex = indexOfNode;
nodeTagValue = tagValue;
}
public int nodeIndex; //coming from each node in the navmesh.
public uint nodeTagValue; //filled with the node tag as it first appears in the scene (determined and saved during Editor creation).
//public bool isClaimed = false; //has this node already been used to restore information.
}
//other class script
[SerializeField]
private List<AdditionalNodeData> andL = new List<AdditionalNodeData>(); //a struct containing node data as it was in a 'clean state' before modification.
public List<AdditionalNodeData> Andl { set{andL = value;} get{return andL;} }
I know I could save some data out as a scriptable object (and maybe I will), but for now its faster to just copy/paste the data from the Play session out to the script after I'm done.
So, there is obviously a way to do it, but I'm still not sure I understand what it is. Any clarification / pointer to the proper reading material is appreciated.
Comment