Page 1 of 2

OnUse() don't work in my 2D game

Posted: Wed Aug 18, 2021 12:13 pm
by DryreL
Hello,

I'm having a problem in this project and I would like ask what am I doing wrong.
When I'm getting close to NPC, press E button don't work, I can't even see the UI.
Image
Player and NPC characters use Corgi Engine scripts, is it uncompatible with this plugin?

I watched this tutorial and applied all steps to my game


I created new child gameobject for both player and npc called Dialogue.

Player:
Image
Image
Image
Image
I also added Selector component but still same.

NPC:
Image
Image
Image

I need help!
Thanks in advance.

Re: OnUse() don't work in my 2D game

Posted: Wed Aug 18, 2021 12:56 pm
by Tony Li
Hi,

For all 2D games, make sure to enable 2D support.

For Corgi, please also see: Corgi Integration.

Re: OnUse() don't work in my 2D game

Posted: Wed Aug 18, 2021 2:46 pm
by DryreL
Thanks! I applied them.

Image

It works, UI shows up. But when I press E to talk with NPC, I'm getting this 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 <695d1cc93cca45069c528c15c9fdd749>:0)
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityEngine.Events.InvokableCall`1[T1]..ctor (System.Object target, System.Reflection.MethodInfo theFunction) (at <6a104889781c465ca00c12d0953583e2>:0)
UnityEngine.Events.CachedInvokableCall`1[T]..ctor (UnityEngine.Object target, System.Reflection.MethodInfo theFunction, System.Boolean argument) (at <6a104889781c465ca00c12d0953583e2>:0)
UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at <6a104889781c465ca00c12d0953583e2>:0)
UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at <6a104889781c465ca00c12d0953583e2>:0)
UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at <6a104889781c465ca00c12d0953583e2>:0)
UnityEngine.Events.UnityEventBase.PrepareInvoke () (at <6a104889781c465ca00c12d0953583e2>:0)
UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) (at <6a104889781c465ca00c12d0953583e2>: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:200)
PixelCrushers.DialogueSystem.ConversationController:Initialize(ConversationModel, ConversationView, Boolean, EndConversationDelegate) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:150)
PixelCrushers.DialogueSystem.DialogueSystemController:StartConversation(String, Transform, Transform, Int32) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:936)
PixelCrushers.DialogueSystem.DialogueManager:StartConversation(String, Transform, Transform, Int32) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueManager.cs:446)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:DoConversationAction(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:949)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:Fire(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:694)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform, Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:676)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:TryStart(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:662)
PixelCrushers.DialogueSystem.DialogueSystemTrigger:OnUse(Transform) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Triggers/DialogueSystemTrigger.cs:508)
UnityEngine.GameObject:BroadcastMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.ProximitySelector:UseCurrentSelection() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Interaction/ProximitySelector.cs:255)
PixelCrushers.DialogueSystem.ProximitySelector:Update() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Triggers/Interaction/ProximitySelector.cs:219)

Re: OnUse() don't work in my 2D game

Posted: Wed Aug 18, 2021 3:43 pm
by Tony Li
Hi,

Inspect your Dialogue System Events component's OnConversationStart() event. It's misconfigured.

Re: OnUse() don't work in my 2D game

Posted: Fri Aug 20, 2021 5:05 am
by DryreL
Tony Li wrote: Wed Aug 18, 2021 3:43 pm Hi,

Inspect your Dialogue System Events component's OnConversationStart() event. It's misconfigured.
Hello! I checked it and found that empty events cause this issue. It was Proximity.enabler true and false, somehow deleted on its own. I added back and problem fixed.

I checked both Corgi Example scene and this manual. It was helpful!

I had a little problem regarding mouse visibility. In gameplay, there's no mouse visibility. Only ESC button shows up the mouse, it opens a menu naturally. But when I'm talking to NPC, mouse still unvisible.
If you want to allow the player to click on response menu buttons using the mouse, inspect UICamera → Canvas → Fader and untick Raycast Target. Otherwise Corgi's Fader will prevent mouse input.
I did that but nothing changed.

---

Image

Face() sequencer cause UI flip.

---

I copied 4x NPC from Corgi Example to my scene. And Zoom2D() does not work unfortunately.

---

Any ideas?

Re: OnUse() don't work in my 2D game

Posted: Fri Aug 20, 2021 9:08 am
by Tony Li
Hi,
DryreL wrote: Fri Aug 20, 2021 5:05 amI had a little problem regarding mouse visibility. In gameplay, there's no mouse visibility. Only ESC button shows up the mouse, it opens a menu naturally. But when I'm talking to NPC, mouse still unvisible.
Add an MMCursorVisible component to the NPC's CorgiStandardDialogueControls child GameObject.
DryreL wrote: Fri Aug 20, 2021 5:05 amFace() sequencer cause UI flip.
Add a MatchCharacterDirection component to the NPC's CorgiStandardDialogueControls child GameObject.
DryreL wrote: Fri Aug 20, 2021 5:05 amI copied 4x NPC from Corgi Example to my scene. And Zoom2D() does not work unfortunately.
Corgi can use Cinemachine to control the camera. If your scene uses Cinemachine, use the Dialogue System's Cinemachine integration to control the camera (e.g., Cinemachine Priority On Dialogue Event component, or CinemachinePriority() and CinemachineTarget() sequencer commands).

Re: OnUse() don't work in my 2D game

Posted: Fri Aug 20, 2021 12:02 pm
by DryreL
Hi,

Thank you for your help!

- MMCursorVisible cause instant on/off cursor visibility. Like flickers. Didn't solve the problem, still needs adjustments. What should I do?

- MatchCharacterDirection solved the problem!

Last one didn't fix the problem or I didn't manage to do that. Can you check it?

Image

Yes, I'm using Cinemachine. It's enabled by default on Corgi Engine.

Image
I added Cinemachine Priority On Dialogue Event component to NPC's CorgiStandardDialogueControls child GameObject.

And this is the Sequencer on Dialogue.
Image

Zoom animation don't work.

---

I have plans for multiple language and I need word wrap option to make it automatic for me.
At the moment, it shows one paragraph and seems really bad, out of resolution.
Image

How can I enable word wrap?

Thanks in advance!

Re: OnUse() don't work in my 2D game

Posted: Fri Aug 20, 2021 12:41 pm
by DryreL
Hi,

Also I tried to add TextMeshPro to CorgiStandardDialogueControls.

Image

I created TMP version of Subtitle Line child object (Subtitle Line TMP), however cannot drag and drop it to CorgiStandardDialogueControls' Subtitle Text element, because there is no "None (TMP UGUI)".

Image
I unpacked the prefab, still didn't show up.

It seems strange, I was able to do that in Dialogue Manager's Canvas, but not this one. Need help again! :(

Re: OnUse() don't work in my 2D game

Posted: Fri Aug 20, 2021 1:04 pm
by Tony Li
Hi,
DryreL wrote: Fri Aug 20, 2021 12:02 pm- MMCursorVisible cause instant on/off cursor visibility. Like flickers. Didn't solve the problem, still needs adjustments. What should I do?
Try ticking the Dialogue System Trigger's Show Cursor During Conversation checkbox.
DryreL wrote: Fri Aug 20, 2021 12:02 pmZoom animation don't work.
Zoom2D() is not compatible with Cinemachine. You must use the Cinemachine commands instead, such as CinemachinePriority().
DryreL wrote: Fri Aug 20, 2021 12:02 pmHow can I enable word wrap?
Please see this post.
DryreL wrote: Fri Aug 20, 2021 12:02 pmAlso I tried to add TextMeshPro to CorgiStandardDialogueControls.
...
I created TMP version of Subtitle Line child object (Subtitle Line TMP), however cannot drag and drop it to CorgiStandardDialogueControls' Subtitle Text element, because there is no "None (TMP UGUI)".
Did you unassign the Text element?

Re: OnUse() don't work in my 2D game

Posted: Sat Aug 21, 2021 4:17 am
by DryreL
Hi,
Thanks for your help!
Tony Li wrote: Fri Aug 20, 2021 1:04 pm Try ticking the Dialogue System Trigger's Show Cursor During Conversation checkbox.
I tried now, but it still same. Cursor visibility flickering. Pause menu has no issue with cursor visibility, always on. In gameplay, it has problem. I wonder why it didn't solve the problem.
Tony Li wrote: Fri Aug 20, 2021 1:04 pm Zoom2D() is not compatible with Cinemachine. You must use the Cinemachine commands instead, such as CinemachinePriority().
Oh okay. I changed Zoom2D to CinemachinePriority but no luck. Can you explain it step by step please?
Image
Tony Li wrote: Fri Aug 20, 2021 1:04 pm Please see this post.
Thanks. I did but it still same.

I tried to add CorgiStandardDialogueControls -> Panel child gameobject. Rect Transform width set to 200 for testing.
Image

CorgiStandardDialogueControls -> Text Panel child gameobject
Image

Any idea?
Tony Li wrote: Fri Aug 20, 2021 1:04 pm Did you unassign the Text element?
Thanks! I was totally forgot. Now it works with Text Mesh Pro UGUI :)

---

Current problems:
- Cursor visibility while Dialogue active
- Zoom in/out while Dialogue active
- Word wrap