Deadcows / MyBox

MyBox is a set of attributes, tools and extensions for Unity
http://deadcow.ru
MIT License
1.94k stars 244 forks source link

Constant errors with conditional field #224

Closed AylanJ123 closed 1 month ago

AylanJ123 commented 1 year ago

I'm using ConditionalField to hide a SearchableEnum. These are the attributes:

[SerializeField, Tooltip("If true, invokes a callback to get the proper behaviour")]
private bool managedResponse;

[Tooltip("Default behaviour when in contact with laser"), SerializeField, ConditionalField("managedResponse", true), SearchableEnum]
private HitType type;

But every time an object has a managed response (Custom code to decide what to do with the laser) this error pops up. That means that it only happens when the field is being hiden.

ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
System.Reflection.Assembly.GetTypes () (at <695d1cc93cca45069c528c15c9fdd749>:0)
MyBox.Internal.ConditionalFieldAttributeDrawer+<>c.<Initialize>b__7_3 (System.Reflection.Assembly x) (at Assets/t3ampo-mixit/ThirdParty/MyBox-1.7.0/Attributes/ConditionalFieldAttribute.cs:127)
System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
MyBox.Internal.ConditionalFieldAttributeDrawer.<Initialize>g__CacheAllDrawersInDomain|7_0 () (at Assets/t3ampo-mixit/ThirdParty/MyBox-1.7.0/Attributes/ConditionalFieldAttribute.cs:130)
MyBox.Internal.ConditionalFieldAttributeDrawer.Initialize (UnityEditor.SerializedProperty property) (at Assets/t3ampo-mixit/ThirdParty/MyBox-1.7.0/Attributes/ConditionalFieldAttribute.cs:111)
MyBox.Internal.ConditionalFieldAttributeDrawer.GetPropertyHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/t3ampo-mixit/ThirdParty/MyBox-1.7.0/Attributes/ConditionalFieldAttribute.cs:58)
UnityEditor.PropertyDrawer.GetPropertyHeightSafe (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at <2cd7f07c7b884ea9bf02386eb91a464c>:0)
UnityEditor.PropertyHandler.GetHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <2cd7f07c7b884ea9bf02386eb91a464c>:0)
UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <2cd7f07c7b884ea9bf02386eb91a464c>:0)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <2cd7f07c7b884ea9bf02386eb91a464c>:0)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <2cd7f07c7b884ea9bf02386eb91a464c>:0)
MyBox.Internal.FoldoutAttributeHandler.Body () (at Assets/t3ampo-mixit/ThirdParty/MyBox-1.7.0/Attributes/FoldoutAttribute.cs:113)
MyBox.Internal.FoldoutAttributeHandler.OnInspectorGUI () (at Assets/t3ampo-mixit/ThirdParty/MyBox-1.7.0/Attributes/FoldoutAttribute.cs:83)
MyBox.Internal.UnityObjectEditor.OnInspectorGUI () (at Assets/t3ampo-mixit/ThirdParty/MyBox-1.7.0/Tools/Internal/UnityObjectEditor.cs:34)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <bf2356d10abb4ac9a31a334d3389ec17>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Deadcows commented 1 month ago

This is the late one 🫣 I think this error was fixed.. several years ago 😯