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

ReflectionTypeLoadException error when selecting object with script containing Attribute "ConditionalField" #203

Closed marcozakaria closed 2 years ago

marcozakaria commented 2 years ago

This error appears in the editor when selecting a gameobject with script containing ConditionalField attribute

error

ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown. System.Reflection.Assembly.GetTypes () (at <695d1cc93cca45069c528c15c9fdd749>:0) MyBox.Internal.CustomDrawerUtility+<>c.b6_0 (System.Reflection.Assembly x) (at Library/PackageCache/com.domybest.mybox@553c6fa733/Tools/Internal/CustomDrawerUtility.cs:94) System.Linq.Enumerable+SelectManySingleSelectorIterator2[TSource,TResult].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.Enumerable+WhereEnumerableIterator1[TSource].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) MyBox.Internal.CustomDrawerUtility.CacheDrawersInAssembly () (at Library/PackageCache/com.domybest.mybox@553c6fa733/Tools/Internal/CustomDrawerUtility.cs:97) MyBox.Internal.CustomDrawerUtility.GetPropertyDrawerTypeForFieldType (System.Type drawerTarget) (at Library/PackageCache/com.domybest.mybox@553c6fa733/Tools/Internal/CustomDrawerUtility.cs:73) MyBox.Internal.CustomDrawerUtility.GetPropertyDrawerForProperty (UnityEditor.SerializedProperty property, System.Reflection.FieldInfo fieldInfo, System.Attribute attribute) (at Library/PackageCache/com.domybest.mybox@553c6fa733/Tools/Internal/CustomDrawerUtility.cs:31) MyBox.Internal.ConditionalFieldAttributeDrawer.CachePropertyDrawer (UnityEditor.SerializedProperty property) (at Library/PackageCache/com.domybest.mybox@553c6fa733/Attributes/ConditionalFieldAttribute.cs:93) MyBox.Internal.ConditionalFieldAttributeDrawer.GetPropertyHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Library/PackageCache/com.domybest.mybox@553c6fa733/Attributes/ConditionalFieldAttribute.cs:49) UnityEditor.PropertyDrawer.GetPropertyHeightSafe (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at <0b8db76a688c4d18a15dd7dfe092a035>:0) UnityEditor.PropertyHandler.GetHeight (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <0b8db76a688c4d18a15dd7dfe092a035>:0) UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <0b8db76a688c4d18a15dd7dfe092a035>:0) UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <0b8db76a688c4d18a15dd7dfe092a035>:0) UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <0b8db76a688c4d18a15dd7dfe092a035>:0) MyBox.Internal.FoldoutAttributeHandler.Body () (at Library/PackageCache/com.domybest.mybox@553c6fa733/Attributes/FoldoutAttribute.cs:105) MyBox.Internal.FoldoutAttributeHandler.OnInspectorGUI () (at Library/PackageCache/com.domybest.mybox@553c6fa733/Attributes/FoldoutAttribute.cs:75) MyBox.Internal.UnityObjectEditor.OnInspectorGUI () (at Library/PackageCache/com.domybest.mybox@553c6fa733/Tools/Internal/UnityObjectEditor.cs:34) UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.b0 () (at <0061ebe704e143298a096ec5cdd83ae3>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Deadcows commented 2 years ago

Thanks for the report. Now it's fixed