[SOLVED] ArgumentException: method arguments are incompatible

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pelikan
Posts: 2
Joined: Mon Aug 31, 2020 7:21 pm

[SOLVED] ArgumentException: method arguments are incompatible

Post by pelikan »

Hello, Newbie here in need of some help.
I'm getting this very long error in unity as soon as my conversation would start:

ArgumentException: method arguments are incompatible
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure, System.Boolean allowClosed) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEngine.Events.InvokableCall`1[T1]..ctor (System.Object target, System.Reflection.MethodInfo theFunction) (at <f56bb44ba853493d87ccc25c2e339f8a>:0)
UnityEngine.Events.CachedInvokableCall`1[T]..ctor (UnityEngine.Object target, System.Reflection.MethodInfo theFunction, System.Boolean argument) (at <f56bb44ba853493d87ccc25c2e339f8a>:0)
UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at <f56bb44ba853493d87ccc25c2e339f8a>:0)
UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at <f56bb44ba853493d87ccc25c2e339f8a>:0)
UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at <f56bb44ba853493d87ccc25c2e339f8a>:0)
UnityEngine.Events.UnityEventBase.PrepareInvoke () (at <f56bb44ba853493d87ccc25c2e339f8a>:0)
UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) (at <f56bb44ba853493d87ccc25c2e339f8a>:0)
PixelCrushers.DialogueSystem.DialogueSystemEvents.OnConversationStart (UnityEngine.Transform actor) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemEvents.cs:123)
UnityEngine.Component:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.ConversationModel:InformParticipants(String, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:194)
PixelCrushers.DialogueSystem.ConversationController:Initialize(ConversationModel, ConversationView, Boolean, EndConversationDelegate) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:148)
PixelCrushers.DialogueSystem.DialogueSystemController:StartConversation(String, Transform, Transform, Int32) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:741)
PixelCrushers.DialogueSystem.DialogueManager:StartConversation(String, Transform, Transform, Int32) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueManager.cs:410)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:DoConversationAction(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:873)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:Fire(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:635)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform, Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:617)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:603)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:OnUse(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:484)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.Selector:UseCurrentSelection() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Interaction/Selector.cs:313)
PixelCrushers.DialogueSystem.Selector:Update() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Interaction/Selector.cs:291)

unfortunately I found nothing about it on google, does anybody have a clue about whats going on and how to fix it? As far as I understand some dialogue system functions / methods are having a conflict with other DS functions, but how could that possibly occur? As I said, I'm a beginner.

thanks in advance and best regards
Felix
Last edited by pelikan on Tue Sep 01, 2020 1:52 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: ArgumentException: method arguments are incompatible

Post by Tony Li »

Hi,

From the dropdown, choose the second instance of whatever method you're assigning, which is under the Static Parameters section:

onConversationStartEvent.png
onConversationStartEvent.png (45.14 KiB) Viewed 4293 times

(The screenshot above is just one example; your menu may vary.)

When you choose a method from the Dynamic Transform section, Unity will always try to pass a Transform parameter to the method. If you've chosen a method that doesn't accept a Transform, it will throw an error.

If you choose the Static Parameters one, you can point it to anything. (That is, unless the method really does accept a Transform, and really do you want the player's Transform. In that case, select the dynamic one.)

If that doesn't fix it for you, please post a screenshot of that section of the Dialogue System Events component. Also include a screenshot of what you've assigned to the OnConversationStart event. If you've assigned a script that you can open, please post the relevant method in the script.
pelikan
Posts: 2
Joined: Mon Aug 31, 2020 7:21 pm

Re: ArgumentException: method arguments are incompatible

Post by pelikan »

ARRGHHHHHH huge facepalm ...
I had my assets ported to a backup version of my game and forgot that my player had a dialogue system events component assigned to it. The events in there were redundant anyways and should have been removed much earlier. They broke (lost all of their connections) when I imported the prefab to my new game version. Thats what caused the errors in the end. Gosh I feel stupid now :D

Thanks alot for the quick and detailed help! I hope this will also help other people who might stumble across this thread :)
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: [SOLVED] ArgumentException: method arguments are incompatible

Post by Tony Li »

Glad to help! Thanks for including your solution.
Post Reply