Saving All Data in a String Array

The title says it all, Is there any way i could save all data in an array?

myArray[100,100] This is the array i would like to save, it is a string array

thanks

If you want to save it at run time then you could use BinaryFormatter as described on this Unity Gems article.

1 Answer

1

If your array is made public in a class derived from MonoBehaviour or ScriptableObject, which is attached to an object in the scene, then it is saved automatically by Unity.

Alternatively you can also tell Unity to serialize any class if you add the Attribute [Serializable].

For private variblables you can use the Attribute [SerializeField] to mark them to be serialized.

There is a really good post about serialization in Unity here : Unity Serialization | Unity Blog