// Save the updated data EditorUtility.SetDirty(data); AssetDatabase.SaveAssets(); } }
Binary serialization is a more robust method for saving complex data structures in Unity. Here's an example of how to use binary serialization to save and edit a custom data class:
// Edit the loaded data loadedData.username = "JaneDoe"; loadedData.score = 200;
// Edit the saved data data.username = "JaneDoe"; data.score = 200;