From 6c844f0b69b2843808a0d30aec46cdd3486cce0f Mon Sep 17 00:00:00 2001 From: TsFreddie Date: Wed, 12 Jun 2024 13:16:25 +0800 Subject: [PATCH] Ignore readonly fields --- Editor/Utilities/TriUnitySerializationUtilities.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Editor/Utilities/TriUnitySerializationUtilities.cs b/Editor/Utilities/TriUnitySerializationUtilities.cs index 5dccd3d..2546f4f 100644 --- a/Editor/Utilities/TriUnitySerializationUtilities.cs +++ b/Editor/Utilities/TriUnitySerializationUtilities.cs @@ -14,6 +14,11 @@ namespace TriInspector.Utilities public static bool IsSerializableByUnity(FieldInfo fieldInfo) { + if (fieldInfo.IsInitOnly) + { + return false; + } + if (fieldInfo.GetCustomAttribute() != null || fieldInfo.GetCustomAttribute() != null) {