public override void OnInspectorGUI() { base.OnInspectorGUI(); if (GUILayout.Button("Save")) { ModelDataSerializer.SerializeDataModeltoDisc(shape.GetShapeData(), Application.persistentDataPath, shape.Name + "Data.xml"); Debug.Log(Application.persistentDataPath); } if (GUILayout.Button("Load")) { var md = ModelDataSerializer.DeSerializeDataModelfromDisc(Application.persistentDataPath, shape.Name + "Data.xml"); shape.SetShapeData(md); } }
public void SpawnShape(int ID) { var shape = Shapes.Find((s) => s.ID == ID); var shapeData = ModelDataSerializer.DeSerializeDataModelfromDisc(Application.persistentDataPath, shape.Name + "Data.xml"); if (CurrentShape != null) { Destroy(CurrentShape.gameObject); } CurrentShape = Instantiate(shape); if (shapeData != null) { CurrentShape.SetShapeData(shapeData); } }