Multidimensional PlayerPrefs

Is there a method for saving Multidimensional arrays as PlayerPrefs? (PlayerPrefsX only gives the option to save 1-dimensional array)

For that matter, any option for transfering multidemsional arrays between scenes would be nice (doesn’t neceseraly need to be PlayerPrefs)

Any help would be greatly appreciated.

I don't know why you'd assume 2D arrays are going to be any larger than 1D arrays. They surely could be, but if you wanted to store a noughts and crosses game (for example), they'd only need to be 3 * 3 * 2 bytes. Using DontDestroyOnLoad is far better though, if you don't need persistence between sessions.

1 Answer

1

As per the comments above, you should only be using PlayerPrefs for saving basic configuration info etc. between sessions- if you have large data structures that you only need to keep between scenes, calling DontDestroyOnLoad on the gameObject to which those scripts are connected is a much cleaner way of stopping things from getting deleted.

If you want to save larger quantities of data, you should look into C#'s inbuilt XML serialization libraries- you can save detailed game information into an xml file in a known location and load from that.