Ok, so I’m trying to create a reorderable list in Unity 5.6 (it really is hell to work with) by following a tutorial on YouTube:
So, the issue is that I’m getting the following errors:
type is not a supported pptr value
UnityEditor.SerializedProperty:get_objectReferenceValue()
NullReferenceException: (null)
Both reporting from this line:
SerializedObject elementObj = new SerializedObject(element.objectReferenceValue);
What I’m trying to do is set up an iterator for the serialized objects (yes, the whole class it’s referencing is serialized):
public void OnEnable()
{
if (target == null)
{
return;
}
awt = (ArcaneWeaponsTest)target;
lineHeight = EditorGUIUtility.singleLineHeight;
lineHeightSpace = lineHeight + 10;
weaponList = new ReorderableList(serializedObject, serializedObject.FindProperty("arcaneWeapons"), true, true, true, true);
weaponList.drawHeaderCallback = (Rect rect) => {
EditorGUI.LabelField(rect, "Weapons");
};
weaponList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
{
SerializedProperty element = weaponList.serializedProperty.GetArrayElementAtIndex(index);
SerializedObject elementObj = new SerializedObject(element.objectReferenceValue);
EditorGUI.LabelField(new Rect(rect.x, rect.y, rect.width, lineHeight), element.FindPropertyRelative("weaponName").stringValue);
SerializedProperty propertyIterator = elementObj.GetIterator();
int i = 0;
while(propertyIterator.NextVisible(true))
{
EditorGUI.PropertyField(new Rect(rect.x, rect.y + (lineHeightSpace * i), rect.width, lineHeight), propertyIterator);
i++;
}
};
}
For some reason I can’t seem to find any info on Google as to what the hell these errors mean, why I’m getting them, or why others don’t seem to when following this.
Is this something simply missing or not working properly in my version of Unity? Is what I’m trying to do simply unfeasible in my version or something?