From a1ee1b5205b99b7e53c0cfd5588a2bd44dc3f439 Mon Sep 17 00:00:00 2001 From: Anders Ejlersen Date: Sun, 12 May 2024 19:46:15 +0200 Subject: [PATCH] 1.9.3: Added support for List, when using SerializedProperty.GetValueType() --- Editor/Extensions/SerializedPropertyExtension.cs | 14 ++++++++++++++ package.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Editor/Extensions/SerializedPropertyExtension.cs b/Editor/Extensions/SerializedPropertyExtension.cs index d00a36d..0ac9018 100644 --- a/Editor/Extensions/SerializedPropertyExtension.cs +++ b/Editor/Extensions/SerializedPropertyExtension.cs @@ -443,6 +443,20 @@ namespace Module.Inspector.Editor obj = arr[index]; } } + else if (objType.IsGenericType && objType.GetGenericTypeDefinition() == typeof(List<>)) + { + if (path.Equals("Array")) + continue; + + objType = objType.GetElementType(); + + if (path.StartsWith("data[")) + { + int index = int.Parse(path.Substring(5, path.Length - 6)); + var list = (IList)obj; + obj = list[index]; + } + } if (objType == null) continue; diff --git a/package.json b/package.json index 82c7f0e..4247fb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.module.inspector", - "version": "1.9.2", + "version": "1.9.3", "displayName": "Module.Inspector", "description": "Custom inspector with various useful property drawers", "unity": "2019.2",