CustomPropertyDrawer property set to null when in List

Hi all. I’m making a basic 2D fighting game, using Unity 5. I have a class called SpecialHitActivator, that tracks the inputs of a player, detects if a special hit should be activated, and eventually activate it. This class have a public list of SpecialHit objects, SpecialHit being a nested class, with an AnimationClip, and a list of strings for its possible input combinations. The list of SpecialHit is determined by a text file I provide in the editor, through a TextAsset object.

I want to make a custom inspector to represent all that data. So far I have done a CustomEditor for my SpecialHitActivator, and a CustomPropertyDrawer for my nested class SpecialHit.

Here is a picture of what it looks like :
53005-specialhitactivator-inspector.png

Basically, my text file contains all the special hit names + combinations for a specific character. As soon as I drag and drop a file in my TextAsset field, the list of special hits is automatically updated, visible but non-editable, so I just have to provide the animation clips (next step is to automate the filling of this field too, provided that the name of the hit and its corresponding animation are equal).

My problem is the following: every time I fold in or fold out any of the lists here (Special Hit List, Directional Jump Kick or Hadouken), all the animation clips are reset to none! I can’t figure out why. Here is the code of my custom editor :

using UnityEngine;
using System.Collections;
using UnityEditor;
using UnityEditor.Animations;

[CustomEditor(typeof(SpecialHitActivator))]
public class SpecialHitActivatorEditor : Editor
{
	public override void OnInspectorGUI ()
	{
		SpecialHitActivator specialHitActivator = (SpecialHitActivator)target;

		serializedObject.Update ();
		EditorGUI.BeginChangeCheck ();

		//TEXTASSET
		specialHitActivator.specialHitListFile = (TextAsset)EditorGUILayout.ObjectField ("Special Hit List File", specialHitActivator.specialHitListFile, typeof(TextAsset), false);
		//ANIMATOR CONTROLLER
		specialHitActivator.animatorController = (AnimatorController)EditorGUILayout.ObjectField ("Animator Controller", specialHitActivator.animatorController, typeof(AnimatorController), false);
		//SPECIAL HIT LIST
		SerializedProperty specialHitListProp = serializedObject.FindProperty ("specialHitList");
		EditorGUILayout.PropertyField (specialHitListProp);
		if (specialHitListProp.isExpanded) {
			int oldIndentLevel = EditorGUI.indentLevel;
			EditorGUILayout.LabelField ("Size: " + specialHitListProp.arraySize);
			EditorGUI.indentLevel += 1;
			for (int i = 0; i < specialHitListProp.arraySize; i++) {
				EditorGUILayout.PropertyField (specialHitListProp.GetArrayElementAtIndex (i));
			}
			EditorGUI.indentLevel = oldIndentLevel;
		}

		if (EditorGUI.EndChangeCheck ()) {
			specialHitActivator.ParseFile ();
			serializedObject.ApplyModifiedProperties ();
		}
	}
}

and here is the code of my custom property drawer :

using UnityEngine;
using UnityEditor;
using System.Collections;

[CustomPropertyDrawer(typeof(SpecialHitActivator.SpecialHit))]
public class SpecialHitDrawer : PropertyDrawer
{

	SerializedProperty combinationListProp;
	SerializedProperty clipProp;

	public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
	{
		combinationListProp = property.FindPropertyRelative ("combinationList");
		clipProp = property.FindPropertyRelative ("clip");
		float height = 16f;
		if (combinationListProp.isExpanded) {
			height += combinationListProp.arraySize * 18;
		}
		return height;
	}

	public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
	{
		EditorGUI.BeginProperty (position, label, property);

		//FOLDOUT
		float foldoutPercentWitdh = 0.35f;
		Rect foldoutPosition = new Rect (position.x, position.y, position.width * foldoutPercentWitdh, 16f);
		combinationListProp.isExpanded = EditorGUI.Foldout (foldoutPosition, combinationListProp.isExpanded, label);

		//ANIMATION CLIP
		float labelWidth = EditorGUIUtility.labelWidth;
		EditorGUIUtility.labelWidth = 50;
		Rect clipPosition = new Rect (position.x + position.width * foldoutPercentWitdh, position.y, position.width * (1 - foldoutPercentWitdh), 16f);
		EditorGUI.PropertyField (clipPosition, clipProp, new GUIContent ("Clip"));
		EditorGUIUtility.labelWidth = labelWidth;

		//HIT COMBINATIONS
		int oldIndentLevel = EditorGUI.indentLevel;
		EditorGUI.indentLevel += 1;
		if (combinationListProp.isExpanded) {
			for (int i = 0; i < combinationListProp.arraySize; i++) {
				Rect pos = position;
				pos.y += (i + 1) * 18f;
				pos.height = 16f;
				SerializedProperty combinationProp = combinationListProp.GetArrayElementAtIndex (i);
				EditorGUI.LabelField (pos, combinationProp.stringValue);
			}
		}
		EditorGUI.indentLevel = oldIndentLevel;

		EditorGUI.EndProperty ();
	}
}

Does anyone have a clue on what’s happening here?
Thanks a lot!

Ok…I’ve been looking for 3 days for this, and I just realized that my method SpecialHitActivator.ParseFile() was bugged…I deeply apologize for this useless topic…