diff --git a/Editor/Utilities/TriUnitySerializationUtilities.cs b/Editor/Utilities/TriUnitySerializationUtilities.cs index 2546f4f..fc0e4e0 100644 --- a/Editor/Utilities/TriUnitySerializationUtilities.cs +++ b/Editor/Utilities/TriUnitySerializationUtilities.cs @@ -27,7 +27,27 @@ namespace TriInspector.Utilities if (fieldInfo.GetCustomAttribute() != null) { - return true; + // if it's a list or array, the base type should be serializable + if (fieldInfo.FieldType.IsArray) + { + var type = fieldInfo.FieldType.GetElementType(); + if (type.IsSerializable || type.IsInterface) + return true; + else + return false; + } + else if (fieldInfo.FieldType.IsGenericType && fieldInfo.FieldType.GetGenericTypeDefinition() == typeof(List<>)) + { + var type = fieldInfo.FieldType.GenericTypeArguments[0]; + if (type.IsSerializable || type.IsInterface) + return true; + else + return false; + } + else + { + return true; + } } if (fieldInfo.IsPublic || fieldInfo.GetCustomAttribute() != null)