Error all of the sudden...?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Hereder
Posts: 76
Joined: Mon Dec 21, 2020 2:53 am

Error all of the sudden...?

Post by Hereder »

Hi!
I've been using this dialogue system for a few months now and it worked perfect until last night when I moved the dialogue system out of the GameManger (Since it pops out every time I press Play anyway) also So I could "Scale With Screen" (It didn't scale with screen while inside the GameManager.) Anyway. Now, I get this error every time I talk to an NPC.

However, If I play the game from start and talk to the first NPC in the game, it works... But not when I play a random scene.
Any idea why this is? I also places one DIalougeManager in each scene. Is that wrong? it works (Apart from the error down below)

This is the Error:

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 <9577ac7a62ef43179789031239ba8798>:0)
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) (at <9577ac7a62ef43179789031239ba8798>:0)
UnityEngine.Events.InvokableCall..ctor (System.Object target, System.Reflection.MethodInfo theFunction) (at <2fae0a4cbcec42c9acc616494aa88f69>:0)
UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at <2fae0a4cbcec42c9acc616494aa88f69>:0)
UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at <2fae0a4cbcec42c9acc616494aa88f69>:0)
UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at <2fae0a4cbcec42c9acc616494aa88f69>:0)
UnityEngine.Events.UnityEventBase.PrepareInvoke () (at <2fae0a4cbcec42c9acc616494aa88f69>:0)
UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) (at <2fae0a4cbcec42c9acc616494aa88f69>:0)
PixelCrushers.DialogueSystem.DialogueSystemEvents.OnConversationStart (UnityEngine.Transform actor) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemEvents.cs:123)
UnityEngine.GameObject:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.DialogueSystemController:StartConversation(String, Transform, Transform, Int32) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:904)
PixelCrushers.DialogueSystem.DialogueManager:StartConversation(String, Transform, Transform, Int32) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueManager.cs:426)
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:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.ProximitySelector:UseCurrentSelection() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Interaction/ProximitySelector.cs:249)
PixelCrushers.DialogueSystem.ProximitySelector:Update() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Interaction/ProximitySelector.cs:221)

Thanks in advance!
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Error all of the sudden...?

Post by Tony Li »

Hi,

It's fine to place a Dialogue Manager GameObject in each scene. It makes it much easier to playtest individual scenes.

However, keep in mind that, by default, at runtime the Dialogue Manager survives scene changes and replaces any Dialogue Manager that's in the new scene.

If your Dialogue Managers are configured differently in different scenes, you may see different behavior if you're playing from the start versus playing an individual scene directly. I recommend saving your customized Dialogue Manager GameObject as a prefab variant. Then use that same prefab variant in all of your scenes. This way, if you change the prefab, the change will automatically be reflected in all scenes.

Also, if your Dialogue Manager points to any objects that are specific to a scene, those pointers will be invalid when you change scenes. For example, say your Dialogue Manager has a Dialogue System Events component that disables movement control on the scene's Player GameObject. After you change scenes, that Dialogue System Events will no longer be valid since it points to a GameObject in the old scene that doesn't exist now.

Something similar may be what's happening with the error you're seeing. At the time of the error, a Dialogue System Events component in the current scene (maybe on the Dialogue Manager, maybe on a scene object) is trying to run its OnConversationStart() UnityEvents, but one of those event assignments is invalid.
Hereder
Posts: 76
Joined: Mon Dec 21, 2020 2:53 am

Re: Error all of the sudden...?

Post by Hereder »

Tony Li wrote: Wed Mar 24, 2021 9:41 am Also, if your Dialogue Manager points to any objects that are specific to a scene, those pointers will be invalid when you change scenes. For example, say your Dialogue Manager has a Dialogue System Events component that disables movement control on the scene's Player GameObject. After you change scenes, that Dialogue System Events will no longer be valid since it points to a GameObject in the old scene that doesn't exist now.

Something similar may be what's happening with the error you're seeing. At the time of the error, a Dialogue System Events component in the current scene (maybe on the Dialogue Manager, maybe on a scene object) is trying to run its OnConversationStart() UnityEvents, but one of those event assignments is invalid.
I see. But I have turned it into a prefab and all values should be same throughout the game. I even replaced the Prefab with the one on the scene where it works... So now that I tried it again. It works if I talk to the first NPC in the game. But if I don't talk to her and go to scene 2, it won't work...

I have a few events in later scenes but nothing on Scene1 where everything works fine. And again, it works throughout the game as long as I speak to the First NPC, which is a bit strange :/ I mean, what power does she hold?! :S
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Error all of the sudden...?

Post by Tony Li »

Hereder wrote: Wed Mar 24, 2021 10:46 am...it works throughout the game as long as I speak to the First NPC, which is a bit strange :/ I mean, what power does she hold?! :S
I have a dog like that. If I don't rub her belly and pet her for several minutes first thing in the morning when I wake up, she lets me know that's she's being terribly neglected. ;)

The problem is with something that's assigned to a Dialogue System Events component's OnConversationStart() UnityEvent.

When you start a conversation that reports the issue, inspect any Dialogue System Events components on the Dialogue Manager GameObject and the conversation's primary Actor and Conversant. Do any of their OnConversationStart() events look incorrect?

The OnConversationStart() event has the option to send the player's Transform to whatever method you've assigned to the event. This may be causing a problem if the method doesn't accept a Transform. If you suspect this is the case, check the dropdown. If the method appears in the "Dynamic Parameters" section at the top of the dropdown and the "Static Parameters" section below it, choose the one in Static Parameters.

If none of that helps, please feel free to send a reproduction project to tony (at) pixelcrushers.com.
Hereder
Posts: 76
Joined: Mon Dec 21, 2020 2:53 am

Re: Error all of the sudden...?

Post by Hereder »

Tony Li wrote: Wed Mar 24, 2021 10:57 am
Hereder wrote: Wed Mar 24, 2021 10:46 am...it works throughout the game as long as I speak to the First NPC, which is a bit strange :/ I mean, what power does she hold?! :S
I have a dog like that. If I don't rub her belly and pet her for several minutes first thing in the morning when I wake up, she lets me know that's she's being terribly neglected. ;)
reproduction project to tony (at) pixelcrushers.com.

Typical spoiled little dogs ;)

It works now !You were right, I had a None (object) on "On Conversation Start" and on "On conversation End".
I don't know what I used to keep there and why they are enmpty (It Must have happen when I pulled the DialougeManager out of my GameManager) - Non the less, it works now! Thanks for the help!
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Error all of the sudden...?

Post by Tony Li »

Glad to help!
Post Reply