How to setup 4 Canvas/UIs.

Announcements, support questions, and discussion for the Dialogue System.
funcookergames
Posts: 12
Joined: Tue May 21, 2019 9:36 pm

How to setup 4 Canvas/UIs.

Post by funcookergames »

Hello!

We have recently purchased and started using the Dialogue System on our first game. We are also fairly new to Unity/C#.

We have an isometric world with a cube player. This player never speaks, but the four walls around the world will occasionally talk to the player, giving them tutorial hints or puzzle clues.

We had the Dialogue System working with 1 canvas/dialogueui/panel/etc, complete with turning off its alpha on camera/room rotation.

We just added four canvases, one on each wall, with each having with its own DialogueUI and parts.

For some reason the wrong Manager (SEDialogueManager) is starting up on load (should NWDialogueManager), which is causing the text to appear on the wrong wall (I believe). I still have no idea why this is overriding our alpha checks, but I digress...

Tried setting up actors without any success, I simply cannot get this conversation to move to the NW wall.

Any help is so greatly appreciated.

Image
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to setup 4 Canvas/UIs.

Post by Tony Li »

Hi,

Thanks for using the Dialogue System!

I recommend structuring it slightly differently. Use only one Dialogue Manager, but keep your 4 dialogue UIs. (By default, Dialogue Managers are like Highlanders. There can be only one, and it lives forever.) So your Hierarchy will look more like this:

Image

I'll assume you're using Dialogue System Triggers to start conversations, although the same idea applies if you're calling DialogueManager.StartConversation() in a C# script or starting conversations any other way. Assuming each wall is assigned as the Dialogue System Trigger's Conversation Conversant, add an Override Dialogue UI component to the wall and assign the corresponding dialogue UI. So for the NE wall, add an Override Dialogue UI component and assign NEDialogueUI to it.

BTW, going back to your 4 Dialogue Managers, if you've already created four separate dialogue databases, you can use the Merge feature on the Dialogue Editor window's Database tab to merge them into a single dialogue database.
funcookergames
Posts: 12
Joined: Tue May 21, 2019 9:36 pm

Re: How to setup 4 Canvas/UIs.

Post by funcookergames »

Thank you so much! You solved our issue super quickly.

You correctly assumed we were using triggers. Also, we started out with one DialogueUI (convinced we only needed 1), but couldn't figure out how to override (awesome!).

However, we ran into an odd issue. How do we stop individual conversations from skipping if we are running multiple conversations at once? (Currently our Dialogue Manager has the Conversation Cancel set to escape). We want this to only effect one conversation. (Or to only have it allowed when those walls are showing, as per our transparencies).

Thank you kindly in advance again, this product has been a wonderful purchase.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to setup 4 Canvas/UIs.

Post by Tony Li »

Hi,

The Cancel input that's assigned to the Dialogue Manager's Input Settings works globally on all active conversations.

Disable the Cancel input and instead use continue buttons or manually call the dialogue UI's OnContinue() method.

To disable the Cancel input, clear the values of the Dialogue Manager's Input Settings > Cancel Subtitle Input > Button Name and Cancel Conversation Input > Button Name, and set the Key dropdowns to None.

If you want the Escape key to only affect visible panels, you can add a script similar to this to each dialogue UI:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class AllowCancelThisDialogueUI : MonoBehaviour
{
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape)) // Did user press Escape?
        {
            var dialogueUI = GetComponent<AbstractDialogueUI>();
            if (dialogueUI.isOpen) // Is this dialogue UI open?
            {
                if (/* YOUR CODE HERE TO DETERMINE VISIBILITY */) // Is wall showing?
                {
                    dialogueUI.OnClick(null); // If yes to conditions above, cancel this conversation.
                }
            }
        }
    }
}
funcookergames
Posts: 12
Joined: Tue May 21, 2019 9:36 pm

Re: How to setup 4 Canvas/UIs.

Post by funcookergames »

Thank you very much again! I am so appreciative for the help - especially being so new to development.

We were able to get this to work, but using dialogueUI.OnContinue(); as opposed to dialogueUI.OnClick(null);

Can I guess that this would interfere with the LUA sequence ability to SetContinueMode(false);?

Right now I am unable to stop certain portions of my conversations from being non-continuable and I can't get the SetContinueMode or 'required' part to function (I could be misunderstanding) from stopping a player from continuing before another action continues.

For example:

I am hoping to stop a player from continuing the conversation while the cube/player is dropping. Or force them to jump before they can use the continue button.

https://twitter.com/FunCookerGames/stat ... 0879828994

in my dialogue entry I have...

required SendMessage(CubeDrop,,MrSceneManager);
required WaitForMessage(CubeLanded);

Edit: Perhaps I am just setting the wrong type of Continue?

---

Also... I am throwing the following error whenever I reset my level.

"MissingReferenceException: The object of type 'TextMeshProDialogueUI' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object."

Everything seems to work correctly... even when reset, it just throws the error?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to setup 4 Canvas/UIs.

Post by Tony Li »

Hi,
funcookergames wrote: Thu May 23, 2019 4:29 amRight now I am unable to stop certain portions of my conversations from being non-continuable and I can't get the SetContinueMode or 'required' part to function (I could be misunderstanding) from stopping a player from continuing before another action continues.
You could update the code to check if the cube is dropping -- or, more generally, if the continue button is currently allowed. For example, change this:

Code: Select all

if (Input.GetKeyDown(KeyCode.Escape)) // Did user press Escape?
to:

Code: Select all

// Did user press Escape AND is continue allowed right now?                    
if (Input.GetKeyDown(KeyCode.Escape) && DialogueManager.displaySettings.subtitleSettings.continueButton == DisplaySettings.SubtitleSettings.ContinueButtonMode.Always)
Then use the SetContinueMode() sequencer command to specify whether the player is allowed to continue. For example, to prevent continue until CubeLanded:

Code: Select all

SetContinueMode(false);
required SetContinueMode(true)@Message(CubeLanded)
Or to prevent continue during an animation:

Code: Select all

SetContinueMode(false);
AnimatorPlayWait(CubeDance)->Message(FinishedDancing);
required SetContinueMode(true)@Message(FinishedDancing)
Or to prevent continue until the player completes some gameplay action such as jumping:

Code: Select all

SetContinueMode(false);
required SetContinueMode(true)@Message(Jumped)
and in a C# script, send "Jumped" to the sequencer:

Code: Select all

if (Input.GetButtonDown("Jump"))
{
    cube.Jump();
    Sequencer.Message("Jumped");
}
---
funcookergames wrote: Thu May 23, 2019 4:29 amAlso... I am throwing the following error whenever I reset my level.

"MissingReferenceException: The object of type 'TextMeshProDialogueUI' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object."
Would you please click on that message in the Console window, press Ctrl+C to copy it to the clipboard, and then paste the clipboard into a reply here? It will include the stack trace that will tell me what's generating the error.

I understand you've already set up your dialogue UI, so take this next suggestion with a grain of salt. TextMeshProDialogueUI is the older script for supporting TextMesh Pro and is primarily included for older projects that were made before the Standard Dialogue UI was introduced. The preferred way now is to enable TextMesh Pro support for the Standard Dialogue UI system. However, this would require you to remove the TextMeshProDialogueUI script, and add and configure the StandardDialogueUI scripts. If you're happy with the way your dialogue UIs are working right now, it's probably easiest to leave them as-is.
funcookergames
Posts: 12
Joined: Tue May 21, 2019 9:36 pm

Re: How to setup 4 Canvas/UIs.

Post by funcookergames »

Thank you again!

I definitely want to learn the newest iteration of the tool so I redid my dialogue UI to remove the older TextMeshPro versions. Thank you for that info!

And thanks for the resource link too, I realized I must have been diving back and forth between the older manual so that helped clear some confusion.

This took an embarrassingly long time to resolve today, but I got there and the walls are not continuing when I don't want them to.

Still throwing the error when I reload/reset the level/scene. Here is that info:

Code: Select all

MissingReferenceException: The object of type 'StandardDialogueUI' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
PixelCrushers.DialogueSystem.DialogueSystemController.RestoreOriginalUI () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:954)
PixelCrushers.DialogueSystem.DialogueSystemController.OnEndConversation (PixelCrushers.DialogueSystem.ConversationController endingConversationController) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Manager/DialogueSystemController.cs:996)
PixelCrushers.DialogueSystem.ConversationController.Close () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:132)
PixelCrushers.DialogueSystem.ConversationController.OnFinishedSubtitle (System.Object sender, System.EventArgs e) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:241)
PixelCrushers.DialogueSystem.ConversationView.FinishSubtitle () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:383)
PixelCrushers.DialogueSystem.ConversationView.OnFinishedSubtitle () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:390)
PixelCrushers.DialogueSystem.Sequencer.FinishSequence () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:469)
PixelCrushers.DialogueSystem.Sequencer.Update () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:462)
Additionally, I am getting these similar errors involving missing panels:

Code: Select all

Dialogue System: Can't find subtitle panel for [NPC] 'Cube Can Move.'.
UnityEngine.Debug:LogWarning(Object)
PixelCrushers.DialogueSystem.StandardUISubtitleControls:ShowSubtitle(Subtitle) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Dialogue/StandardUISubtitleControls.cs:229)
PixelCrushers.DialogueSystem.StandardDialogueUI:ShowSubtitle(Subtitle) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Dialogue/StandardDialogueUI.cs:157)
PixelCrushers.DialogueSystem.ConversationView:StartSubtitle(Subtitle, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:129)
PixelCrushers.DialogueSystem.ConversationController:GotoState(ConversationState) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:168)
PixelCrushers.DialogueSystem.ConversationController:OnFinishedSubtitle(Object, EventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:224)
PixelCrushers.DialogueSystem.ConversationView:FinishSubtitle() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:383)
PixelCrushers.DialogueSystem.ConversationView:OnFinishedSubtitle() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:390)
PixelCrushers.DialogueSystem.Sequencer:FinishSequence() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:469)
PixelCrushers.DialogueSystem.Sequencer:Update() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:462)
Thank you again for the help!
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to setup 4 Canvas/UIs.

Post by Tony Li »

I'll try to clean up those errors in the next update. It sounds like everything's working now. If there are still any issues, just let me know.
funcookergames
Posts: 12
Joined: Tue May 21, 2019 9:36 pm

Re: How to setup 4 Canvas/UIs.

Post by funcookergames »

I am so clearly out of my league so thank you again in advance.

I ran into another problem, which somehow involves my scene reset (On Start Convo Triggers?), which I assume is relating to my errors.

I assume I have set something up incorrectly or am misunderstanding something.

I am currently trying add a second conversation to my scene that adds tutorial instructions to the second wall. It should follow the exact flow of the first conversation, just adding instructions to the keys the player needs to press.

I've tried a few different iterations of conditions, conversation entrys, etc. But it just doesn't seem like my secondary conversations are actually doing anything to move forward past the first entry. Almost like they stop once the primary conversation's first text appears. I think this is actually happening with my other wall, but I didn't notice anything wrong because I don't need the conversation on that wall to move forward.

Oddly enough, each time I reset my scene(loadscene) I get a new iteration of how the conversations trigger. With the last one being the closest (with an odd delay). Video below reloads same level twice.

https://drive.google.com/open?id=1zloEk ... yxvNcOKEgZ

Edit: I was able to get this to appear EXACTLY how I wanted it (timing wise), but ONLY after a level reset (load scene), otherwise the trigger on start doesn't seem to be loading, or another Dialogue UI is interfering with it after the first entry? (best guess)

I have zero idea why I can't get the conversation to roll without resetting - any help greatly appreciated.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to setup 4 Canvas/UIs.

Post by Tony Li »

Hi,

I think it's really close. Would it be possible for you to email a copy of your dialogue database to tony (at) pixelcrushers.com so I can see how each of the nodes is set up?

You want both conversations to run in parallel, correct?
Post Reply