Closed MasterDisaster64 closed 2 years ago
I have a property written like this:
[AutoProperty(AutoPropertyMode.Parent)] public StateMachine machine;
When I save the scene, the property isn't assigned, and this exception is logged:
ArgumentException: Type cannot be null. UnityEngine.GameObject.GetComponentsInParent (System.Type type, System.Boolean includeInactive) (at <eba5c5b2c6de4af992b2cc99354e483e>:0) UnityEngine.Component.GetComponentsInParent (System.Type t, System.Boolean includeInactive) (at <eba5c5b2c6de4af992b2cc99354e483e>:0) MyBox.Internal.AutoPropertyHandler+<>c.<.cctor>b__1_2 (MyBox.EditorTools.MyEditor+ObjectField property, System.Func`2[T,TResult] pred) (at Library/PackageCache/com.domybest.mybox@a587ed2ede/Attributes/AutoPropertyAttribute.cs:99) MyBox.Internal.AutoPropertyHandler.FillProperty (MyBox.EditorTools.MyEditor+ObjectField property) (at Library/PackageCache/com.domybest.mybox@a587ed2ede/Attributes/AutoPropertyAttribute.cs:153) System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) (at <f3aec01a34d14c7080754e28743c8472>:0) MyBox.Internal.AutoPropertyHandler.CheckAssets () (at Library/PackageCache/com.domybest.mybox@a587ed2ede/Attributes/AutoPropertyAttribute.cs:130) MyBox.EditorTools.MyEditorEvents.OnWillSaveAssets (System.String[] paths) (at Library/PackageCache/com.domybest.mybox@a587ed2ede/Tools/MyEditorEvents.cs:63) System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f3aec01a34d14c7080754e28743c8472>:0) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f3aec01a34d14c7080754e28743c8472>:0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <f3aec01a34d14c7080754e28743c8472>:0) UnityEditor.AssetModificationProcessorInternal.OnWillSaveAssets (System.String[] assets, System.String[]& assetsThatShouldBeSaved, System.String[]& assetsThatShouldBeReverted, System.Boolean explicitlySaveAsset) (at <a01bf2e497e84ae285aeb97a3052e6cc>:0) UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
I have the same issue. I'll try to dig into the code of AutoProperty and fix that. I'll create a PR if I'm successful.
@TheWalruzz thanks for the fix!
I have a property written like this:
When I save the scene, the property isn't assigned, and this exception is logged: