From 59f30a17fc4a3cf63d6881ffbc1fab024d1c0384 Mon Sep 17 00:00:00 2001 From: uurha Date: Mon, 5 Jun 2023 04:28:07 +0000 Subject: [PATCH] Merge pull request #39 from uurha/dev Update ReflectionExtensions.cs --- Runtime/Extension/ReflectionExtensions.cs | 10 +++++++++- package.json | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Runtime/Extension/ReflectionExtensions.cs b/Runtime/Extension/ReflectionExtensions.cs index 5a92f03..bc8b98b 100644 --- a/Runtime/Extension/ReflectionExtensions.cs +++ b/Runtime/Extension/ReflectionExtensions.cs @@ -21,7 +21,7 @@ public static bool IsArrayOrList(this Type listType) return false; } - + public static Type[] GetAllInheritedType(this Type baseType) { return AppDomain.CurrentDomain.GetAssemblies().SelectMany(s => s.GetTypes()).Where(p => ArgIsValueType(baseType, p)).ToArray(); @@ -54,6 +54,14 @@ public static Type GetArrayOrListElementType(this Type listType) return null; } + public static Type GetFieldOrElementType(this FieldInfo fieldInfo) + { + if (fieldInfo.IsArrayOrList()) + return fieldInfo.GetArrayOrListElementType(); + + return fieldInfo.FieldType; + } + public static bool IsArrayOrList(this FieldInfo fieldInfo) { if (fieldInfo == null) diff --git a/package.json b/package.json index 8150a4b..6445754 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.uurha.betterextensions", "displayName": "Better Extensions", "description": "Unity extensions, serialize extension, async extension, string extension and UI extensions", - "version": "1.1.4", + "version": "1.1.5", "unity": "2020.1", "author": { "name": "Arcueid D'athemon",