From 0d8740e7ce5a4c7cabfe58144aaefd53c78adc75 Mon Sep 17 00:00:00 2001 From: Ivan Date: Fri, 10 Apr 2020 19:18:34 +0300 Subject: [PATCH] Fixed ArgumentException: Field unlocked defined UniRx.InspectorDisplayDrawer.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs:126) When using ODIN serialization for ReactiveProperties: - InspectorDisplayAttribute - IntReactiveProperty - LongReactiveProperty - ByteReactiveProperty - FloatReactiveProperty - DoubleReactiveProperty - StringReactiveProperty - BoolReactiveProperty - Vector2ReactiveProperty - Vector3ReactiveProperty - Vector4ReactiveProperty - ColorReactiveProperty - RectReactiveProperty - AnimationCurveReactiveProp - BoundsReactiveProperty - QuaternionReactiveProperty --- .../Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs index 9dd43164..7318cdc0 100644 --- a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs @@ -123,8 +123,12 @@ public override void OnGUI(Rect position, UnityEditor.SerializedProperty propert var paths = property.propertyPath.Split('.'); // X.Y.Z... var attachedComponent = property.serializedObject.targetObject; - var targetProp = (paths.Length == 1) - ? fieldInfo.GetValue(attachedComponent) + var targetProp = (paths.Length == 1) ? +#if ODIN_INSPECTOR + attachedComponent.GetType().GetField(fieldInfo.Name).GetValue(attachedComponent) +#else + fieldInfo.GetValue(attachedComponent) +#endif : GetValueRecursive(attachedComponent, 0, paths); if (targetProp == null) return; var propInfo = targetProp.GetType().GetProperty(fieldName, BindingFlags.IgnoreCase | BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);