Serialising ArrayLists

Another day, another question! Still going round in circles in my quest for a custom inspector and after battling the lack is an isNull method in C# I find myself in the present situation -

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[System.Serializable]
public class InteractiveNPC : MonoBehaviour {

    public ArrayList dialogueStore = new ArrayList();
    public int dialogueCount = 0;

...

Now, according to the documentation - http://unity3d.com/support/documentation/ScriptReference/SerializeField.html (SerializeField is irrelevant, however this page contains the list of serialisable objects) - Serialisable Arrays are serialisable in Unity. Lovely, so I checked that ArrayLists are serialisable and lo, MSDN - http://msdn.microsoft.com/en-us/library/system.collections.arraylist(VS.71).aspx - confirms that ArrayLists are serialisable, so in theory, I should be all good.

But then my question is, why does this happen:

using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;

[CustomEditor(typeof(InteractiveNPC))]
public class InteractiveNPCInspector : Editor {

    SerializedObject obj;
    SerializedProperty dialogueStore;
    SerializedProperty dialogueCount;

    private ArrayList localStore = new ArrayList();

    void OnEnable() {
        obj = new SerializedObject(target);
        Debug.Log("Object: " + obj);
        //Object: UnityEditor.SerializedObject
        dialogueStore = obj.FindProperty("dialogueStore");
        Debug.Log("Store: " + dialogueStore);
        //Store:
        dialogueCount = obj.FindProperty("dialogueCount");
        Debug.Log("Count: " + dialogueCount);
        //Count: UnityEditor.SerializedProperty
    } 
     ...

Given I can retrieve the object itself, and the int property, why doesn't the ArrayList get retrieved? And also, why does it silently fail (until I try to use it..).

Answers on a postcard!

ArrayLists can't be serialized as they can hold any random object - You'll want to use List instead

As an added bonus, List will help with your code - you can't add random junk into it, only types which are the same (or subclasses) of the type of the list

If you haven't used them before, you'll need to be using System.Collections.Generic, and you declare them (and in this case instantiate) as such:

List<TypeYouWantToStore> myList = new List<TypeYouWantToStore>();

It doesn't say serializable arrays, it says "Arrays of a serializable type".

So an array of one of the serializable types mentioned therein would be serializable.

Because an ArrayList is non-typed and can hold pretty much anything, it would not be guaranteed to be an array of a serializable type and would therefore not be serializable. As Mike mentioned, a List, being a typed array would however be serializable.