I want to clear the parent of the referenced transform in the UnityEvent, but assigning * Transform -> SetParent() * or * Transform -> parent * as function to call and leaving the parameter to null causes an ArgumentException:
ArgumentException: failed to convert parameters
System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:484)
System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:528)
System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/ConstructorInfo.cs:77)
UnityEngine.Events.PersistentCall.GetObjectCall (UnityEngine.Object target, System.Reflection.MethodInfo method, UnityEngine.Events.ArgumentCache arguments) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:429)
UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:396)
UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:569)
UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:736)
UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:772)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:52)
This is on a prefab though, so setting the parent to an other transform far away is not possible.
Is there any way to without scripting this? I dont want to create a new script just for this.
Using 2018.2
↧