Hello,
First, sorry for my english (I’m French).
I work on a project for myself, and I have a question about ScriptableObject. I manipulate it for the first time (previously, I used “BinaryFormatter” to save my properties). I read carefully posts here
http://forum.unity3d.com/threads/serialization-best-practices-megapost.155352/
And this
http://www.jacobpennock.com/Blog/?p=670
I have a problem with my “public byte[,] data” (which is “serializefield”) inside a ScriptableObject. All of my value (string, int, etc.) are saved, except this byte[,].
I have a custom inspector to see each value on my asset (it’s like a debug), and everything is ok when I fill it, I have all of my values.
When my ScriptableObject go on OnEnable(), I see I lost all values in my byte[,], and other values like int, string, are always here. I use EditorUtility.SetDirty() to save all of my data.
I have an error message in console which told me “NullReferenceException: Object reference not set to an instance of an object” in the ScriptableObject when I try to make Debug.log(data[0,0,0]) in the OnEnable(). So I tried to make “data = new byte[x,y,z]”, and of course, the error left, but my data is empty now…
So, this is my question : Is it possible to save a byte[,] (and other array) inside a ScriptableObject ? (I haven’t find the answer on the first link. I saw a “List<>”, but I don’t want that)
If you have any others advices for ScriptableObject, I will be happy to hear you !
Thanks for your answer. If you need more informations, I will be happy to send it.
Hello and thanks for your answer ! After some search on internet, I saw this : http://answers.unity3d.com/questions/35361/array-of-arrays-no-serialization.html Unity seems to not be able to serialize multi-dimensional array today (since 2010...^^). I saw they add the possibility to serialize a struct in the Unity 4.5, so, perhapse one day, we will be able to serialize array[,] ! Thank you !
– Katasa