|
I have a class defined inside a component. It's more or less just a struct of raw data:, i.e. I also have an editor script, changing the contents of mListOfDatas. Unfortunately, this data is not showing up in the component UI, and i'm guessing that only stuff shown in the UI will actually save. Is this the case, and is there a way to force this data to save to the prefab, or force it to display? I think I'm getting to the limits of the prefab system, here.
(comments are locked)
|
|
First, only public variables or private variables with SerializeField attribute are serialized. Also you can only serialize arrays or lists of serializeable types. You can turn your DataElement class into a serialized type by adding the Serializable attribute Thanks so much! Worked perfectly!
Jul 18 '11 at 03:15 PM
Aubrey Hesselgren
I lied! It only seems to store the first element when I close and re-open. And sometimes forgets normal, "public" stuff. Does using [SerializeField] once mean I have to start using it everywhere in that class?
Jul 20 '11 at 10:36 AM
Aubrey Hesselgren
(comments are locked)
|
|
Add [Serializable] before your custom class declaration. Then the public members will be saved/editable like the ones in your MonoBehaviour. i.e.
(comments are locked)
|
