-
assigned issue to
- changed version to 1.0.6.0
Invalid IL code using ValidateInput on struct field
Issue #297
resolved
I get an exception in the console when using the Inspector to view a struct with ValidateInputAttribute on its fields.
This is with Unity 2017.3p2 on Linux x86_64, using Odin 1.0.6.0.
Sirenix.OdinInspector.Editor.Drawers.ValidateInputAttributeDrawer`1+InnerDrawer`1[System.Single,MyStruct].RunValidation (IPropertyValueEntry`1 entry, Sirenix.OdinInspector.ValidateInputAttribute attribute, Sirenix.OdinInspector.Editor.PropertyContext`1 context) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/TwoDimensionalArrayDrawer.cs:429)
UnityEngine.Debug:LogException(Exception)
Sirenix.OdinInspector.Editor.Drawers.InnerDrawer`1:RunValidation(IPropertyValueEntry`1, ValidateInputAttribute, PropertyContext`1) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/TwoDimensionalArrayDrawer.cs:429)
Sirenix.OdinInspector.Editor.Drawers.InnerDrawer`1:DrawPropertyLayout(IPropertyValueEntry`1, ValidateInputAttribute, GUIContent) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/TwoDimensionalArrayDrawer.cs:379)
Sirenix.OdinInspector.Editor.Drawers.ValidateInputAttributeDrawer`1:DrawPropertyLayout(IPropertyValueEntry`1, ValidateInputAttribute, GUIContent) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/TwoDimensionalArrayDrawer.cs:337)
Sirenix.OdinInspector.Editor.OdinAttributeDrawer`2:DrawPropertyLayout(InspectorProperty, ValidateInputAttribute, GUIContent) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:539)
Sirenix.OdinInspector.Editor.OdinAttributeDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:384)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(InspectorProperty, GUIContent) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:81)
Sirenix.OdinInspector.Editor.Drawers.PrimitiveValueConflictDrawer`1:DrawPropertyLayout(IPropertyValueEntry`1, GUIContent)
Sirenix.OdinInspector.Editor.OdinValueDrawer`1:DrawProperty(IPropertyValueEntry`1, GUIContent)
Sirenix.OdinInspector.Editor.OdinValueDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(InspectorProperty, GUIContent) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:81)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(IPropertyValueEntry, GUIContent)
Sirenix.OdinInspector.Editor.Drawers.PropertyContextMenuDrawer`1:DrawPropertyLayout(IPropertyValueEntry`1, GUIContent)
Sirenix.OdinInspector.Editor.OdinValueDrawer`1:DrawProperty(IPropertyValueEntry`1, GUIContent)
Sirenix.OdinInspector.Editor.OdinValueDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty)
Sirenix.OdinInspector.Editor.Drawers.CompositeDrawer:DrawPropertyImplementation(InspectorProperty, GUIContent) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/ColorDrawer.cs:73)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(InspectorProperty, GUIContent) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:81)
Sirenix.OdinInspector.Editor.Drawers.PrimitiveValueConflictDrawer`1:DrawPropertyLayout(IPropertyValueEntry`1, GUIContent)
Sirenix.OdinInspector.Editor.OdinValueDrawer`1:DrawProperty(IPropertyValueEntry`1, GUIContent)
Sirenix.OdinInspector.Editor.OdinValueDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(InspectorProperty, GUIContent) (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:81)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(IPropertyValueEntry, GUIContent)
Sirenix.OdinInspector.Editor.Drawers.PropertyContextMenuDrawer`1:DrawPropertyLayout(IPropertyValueEntry`1, GUIContent)
Sirenix.OdinInspector.Editor.OdinValueDrawer`1:DrawProperty(IPropertyValueEntry`1, GUIContent)
Sirenix.OdinInspector.Editor.OdinValueDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawPropertiesInTree(PropertyTree)
Sirenix.OdinInspector.Editor.PropertyTree:Draw(Boolean)
Sirenix.OdinInspector.Editor.OdinEditor:OnInspectorGUI() (at D:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Children/GroupPropertyChildren.cs:50)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
This is reproducible for me with the following file contents:
using Sirenix.OdinInspector;
public struct MyStruct
{
[ValidateInput("ValidateValue")]
public float interalValue;
bool ValidateValue(float val)
{
return val >= 0 && val <= 100;
}
}
public class MyStructTest : SerializedMonoBehaviour
{
public MyStruct aStruct;
}
Comments (3)
-
-
- changed status to open
-
- changed status to resolved
Fixed in 1.1.
- Log in to comment
I've confirmed the issue, and we'll be sure to make a fix for this. Thanks for reporting this.