Override Default Canvas for Dialogue UI

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Senua
Posts: 5
Joined: Fri May 24, 2019 5:11 pm

Override Default Canvas for Dialogue UI

Post by Senua »

Hello, hoping someone might be able to point me in the right direction:

I have 2 npcs that each have their dialogue canvas in world space next to them. However, only the canvas I point to as Default Canvas in the Dialogue Manager functions without error. The one that is not specified as the Default Canvas (and I can switch them without any issue, whichever one is pointed to, works) will throw the error about the new input system (this happens with I have it set to On Trigger Enter, On Use, or On Start -- again all of these work fine if the canvas is specified as default in DM. I also do not get an error about the new input system when only using the one npc, with its canvas specified as the Default canvas in Dialogue Manager.

I see the Override Dialogue UI, but is there an Override Canvas? I did try putting the Override D. UI on the two NPCs but this did nothing -- the error persists for the one who's canvas is not specified as default.

If the error ultimately is still tied to the input issue, I did try the MyController script fix in the pdf, and also the current Dialogue Manager has the DemoInputRegistration script on it.
User avatar
Tony Li
Posts: 21970
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override Default Canvas for Dialogue UI

Post by Tony Li »

Hi,

Are you using the Input System package or Unity's default built-in input manager?

What is the error? Please click on it in the Console window, press Ctrl+C (Cmd+C on Mac) to copy its details to the clipboard, then paste it into a reply here.
Senua
Posts: 5
Joined: Fri May 24, 2019 5:11 pm

Re: Override Default Canvas for Dialogue UI

Post by Senua »

Hi,
We are using Unity's Input System package.

Error:
InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
UnityEngine.Input.get_mousePosition () (at <506c985d301a4e73acb07071627a3aa1>:0)
PixelCrushers.DialogueSystem.UnityGUI.GUIRoot.OnGUI () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Legacy/GUI Controls/GUIRoot.cs:36)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
User avatar
Tony Li
Posts: 21970
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override Default Canvas for Dialogue UI

Post by Tony Li »

Hi,

This means it's unable to find a dialogue UI, so it's using a fallback IMGUI (OnGUI) UI. This fallback IMGUI UI is not compatible with the Input System package, and should never be used anyway.

The solution is to make sure the Dialogue System knows what dialogue UI to use. Please use this setup:

Option 1 - NPCs use entirely different dialogue UIs:

1. Inspect the Dialogue Manager GameObject. The Dialogue Manager has a child Canvas. Assign this to the Dialogue Manager's Default Canvas property. Assign the Basic Standard Dialogue UI prefab to the Dialogue UI property.

2. Assuming each NPC has its own world space canvas with a complete dialogue UI (e.g., Standard Dialogue UI component, with children including subtitle panel, response menu panel, alert panel, etc.), add an Override Dialogue UI component to the NPC. Assign the NPC's world space dialogue UI to its UI property.


Option 2 - NPCs use their own world space subtitle panels and/or menu panels:

1. Inspect the Dialogue Manager GameObject. The Dialogue Manager has a child Canvas. Assign this to the Dialogue Manager's Default Canvas property. Assign the Basic Standard Dialogue UI prefab to the Dialogue UI property. (This is the same as Option 1 above.)

2. Add a Dialogue Actor component to the NPC. Set the Actor dropdown. If the NPC has a world space subtitle panel, set Standard Dialogue UI Settings > Subtitle Panel Number to Custom, and assign the subtitle panel.

The steps for Option 2 are also detailed here: How To: Show Overhead Conversation Bubble Text
Senua
Posts: 5
Joined: Fri May 24, 2019 5:11 pm

Re: Override Default Canvas for Dialogue UI

Post by Senua »

Thank you very much.
Option 1 is what we are going for, and I located my error in your step 2 -- the NPCs' canvases were missing one element of their dialogue UI. All is working perfectly now.
Thank you!
User avatar
Tony Li
Posts: 21970
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override Default Canvas for Dialogue UI

Post by Tony Li »

Great! Happy to help.
Post Reply