Search Unity

[RELEASED] Dialogue System for Unity - easy conversations, quests, and more!

Discussion in 'Assets and Asset Store' started by TonyLi, Oct 12, 2013.

  1. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @ImFaisal - Please import two unitypackages:
    • Plugins / Pixel Crushers / Common / Third Party Support / Invector Support
    • Plugins / Pixel Crushers / Dialogue System / Third Party Support / Invector Support
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Check out Rock Paper Shotgun's "The best game you missed in December 2020: Suzerain"

    Suzerain is made with the Dialogue System for Unity!

    Suzerain is on sale now on Steam, GOG, and Humble.

    The Dialogue System is currently 50% off in the Asset Store's New Year Sale.

     
  3. weto4ka

    weto4ka

    Joined:
    Feb 8, 2019
    Posts:
    48
    Happy NY!
    I have 1 question)
    I want to create few conversations on runtime and add it to master Database and left them here. (don't delete after runtime stops). Where I could find newly created conversations? And could it be done like that?
    Code (CSharp):
    1. var database = ScriptableObject.CreateInstance<DialogueDatabase>();
    2.     database.conversations.Add(conversation);
    3.     DialogueManager.AddDatabase(database);
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @IspirationHappynes - If you want them to remain as assets in the project, this will only work in the editor. (You can't create new assets in a build.) To save it as an asset in the editor, use AssetDatabase.CreateAsset().

    If you want to save the database at runtime in builds, you could save it as a JSON string:
    Code (csharp):
    1. string s = JsonUtility.ToJson(database);
    Later, you can turn that json back into a database:
    Code (csharp):
    1. var database = JsonUtility.FromJson<DialogueDatabase>(s);
     
  5. weto4ka

    weto4ka

    Joined:
    Feb 8, 2019
    Posts:
    48
    thanks a lot)
    and I have class with entry lists, and I try to save it as JSON in database variable for feature use, but it seems that List with entries don't save as JSON file. bundlesToJason is always empty like: "{}", but bundles has entries in lists...
    This is how I save it in Database:
    Code (CSharp):
    1. string bundlesToJason = bundles.SaveToString();
    And this is my class:
    Code (CSharp):
    1. [Serializable]
    2.   public class Bundles {
    3.      //Elements that is part of bundles
    4.     public List<DialogueEntry> list1 { get; set; }
    5.     public List<DialogueEntry> list2 { get; set; }
    6.     public List<DialogueEntry> list3 { get; set; }
    7.     public List<DialogueEntry> list4 { get; set; }
    8.      public string SaveToString()
    9.     {
    10.         return JsonUtility.ToJson(this);
    11.     }
    12.  
    13.   }
    Even if Bundles is not empty, the bundlesToJason is always empty like this: "{}"... What could I do to save entire lists? Is it possible to do it with JSON?
     
  6. weto4ka

    weto4ka

    Joined:
    Feb 8, 2019
    Posts:
    48
    Also, may be I miss some settings.. I get variable value, modify existing value and then set new modified value to variable (via script). But when I stop runtime and check database it still the same variable value, it doesn't change... What do I need to do to change variable value at runtime? cause I do this, but it doesn't help:
    Code (CSharp):
    1. var bundleCode = DialogueLua.GetVariable("bundle"+(i+1).ToString()).asString;
    2. bundleCode += fieldCode;
    3. DialogueLua.SetVariable("bundle"+(i+1).ToString(), bundleCode);
     
  7. wisteriasky

    wisteriasky

    Joined:
    Nov 2, 2020
    Posts:
    3
    Hello! I'm using both the dialogue system and top down engine for my game. I'd like to make simple cutscenes where an npc or my player can walk from point a to point b. So far this is what I have,

    SetContinueMode(false);
    AnimatorPlay(Walking);
    AnimatorBool(Idle, false);
    MoveTo(Aloe, speaker, 12);
    SetContinueMode(true)@12;


    With this code the npc plays the walk animation once and then idles while gliding over to the target, I'd like her to play the walking animation the entire way and face the direction shes headed.
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi,
    Unity does not serialize properties. It only serializes variables. Change this:
    Code (csharp):
    1. public List<DialogueEntry> list1 { get; set; }
    to this:
    Code (csharp):
    1. public List<DialogueEntry> list1;
    The Dialogue Editor's panels show the values in the dialogue database asset file. They do not show the current runtime values -- except for the Watches panel. Use the Watches panel or the Variable Viewer window to see the runtime values of variables.
     
    weto4ka likes this.
  9. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @wisteriasky - Your animator controller's Walking state probably has a transition arrow to the Idle state. If the conditions on the transition arrow are true, then the animator will automatically change from the Walking State to the Idle state.

    Check those conditions. For example, it might transition based on the value of a float parameter named "Speed":

    upload_2021-1-6_11-2-17.png

    If that's the case, then use the AnimatorFloat() sequencer command to temporarily set Speed to, say, 1.0 to prevent it from transitioning to Idle.
     
  10. wisteriasky

    wisteriasky

    Joined:
    Nov 2, 2020
    Posts:
    3
    Thanks for the quick response! So I realized I never put the Pause TopDown During Conversations component and thats what was making the npc transition back to idle I think. I also set the speed to 2 just for testing and with or without the speed float, the npc glides in the walking animation first frame but doesnt play the entire animation. I'm getting very close!
     

    Attached Files:

  11. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Hey Tony!
    I'm back in regards to the ultimate inventory system integration.
    So I've been talking with the creator of Ultimate inventory system about the fact that my player input etc doesn't get disabled while shopping, so I figured that it might be related to the integration.

    The player can still look and move around after opening the shop through a sequence (the sequence I mentioned before).
    Do you perhaps have any idea what could cause this?
    The creator of UIS didn't see anything wrong with my components so far so I figured it might be the integration. Cheers
     
  12. weto4ka

    weto4ka

    Joined:
    Feb 8, 2019
    Posts:
    48
    Thanks a lot) it helps)
    How could I save runtime variable values in the dialogue database asset file?
    I want to change initial value of variable on runtime, so when runtime is stops I have new initial value for variable, not old that I have before.
     
    Last edited: Jan 6, 2021
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Open the Animator window on the NPC, and keep an eye on it while that sequence plays. If it plays Walking for just a frame and then immediately transitions to Idle, check the transition arrow's conditions. It's possible that something else, such as TDE, is setting animator parameters that cause the transition to fire.

    If you've added the Pause TopDown During Conversations component to the Dialogue Manager, it will always pause the player when a conversation plays. If you've added it to the player prefab, it will only pause the player when the player is one of the primary participants of the conversation. You may need to add a Dialogue Actor component to your player prefab to mark it as the player. Also check the Float & Bool Animator Parameters to Stop. You'll notice in the integration's example scene that the Pause Topdown During Conversations component on the Dialogue Manager set Speed to zero and several Boolean parameters to false.

    The integration leaves that up to you if you want to allow the player to move around. You can register methods with the Shop Menu Opener component's OnOpen and OnClose events to pause and unpause player movement controls. If you need some assistance with what, what kind of player input/controls are you using? Custom scripts? A character controller asset?

    Are you sure you want to save it in the dialogue database asset? Do you instead want to just save and restore your game? For example, if you play DemoScene1, you can press Esc to open the demo menu. Then you can click the Save button to the save game, or the Load button to load the last saved game. This doesn't save anything to the dialogue database asset. It saves the game using the Dialogue System's save system.
     
  14. Froghuto

    Froghuto

    Joined:
    Oct 4, 2012
    Posts:
    61
    We're currently looking into using twine to write our dialogues but I have a hard time figuring out how to write a simple dialogue in twine between two characters that just each say one line.
    This is what I do in twine (which I guess is wrong):


    and this is what it then looks like in Unity:


    Do you by chance have an example twine story that illustrates what features can be used and how it's done?
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Froghuto -

    In the Dialogue System, every conversation has two primary participants: the conversation's actor and conversant. When it's a player/NPC conversation, usually the player is the actor and the NPC is the conversant.

    When importing from Twine, passage text is assigned to the conversant. Link text is assigned to the actor. See the screenshot below:

    upload_2021-1-7_8-50-16.png

    If you want to assign an addition character to a passage (as in the Third Line passage above), include the character's name at the front of the passage text.

    When you output this to Twison JSON format, it will look like this:

    Code (plaintext):
    1.  
    2. {
    3.   "passages": [
    4.     {
    5.       "text": "This passage is assigned to the conversation's conversant.\n[[This passage is assigned to the conversation's actor --> Third Line]]",
    6.       "links": [
    7.         {
    8.           "name": "This passage is assigned to the conversation's actor -",
    9.           "link": " Third Line",
    10.           "pid": "2"
    11.         }
    12.       ],
    13.       "name": "Untitled Passage",
    14.       "pid": "1",
    15.       "position": {
    16.         "x": "860",
    17.         "y": "384.5"
    18.       }
    19.     },
    20.     {
    21.       "text": "Narrator: This passage is assigned to a third character named Narrator.",
    22.       "name": " Third Line",
    23.       "pid": "2",
    24.       "position": {
    25.         "x": "860",
    26.         "y": "534.5"
    27.       }
    28.     }
    29.   ],
    30.   "name": "Basic Story",
    31.   "startnode": "1",
    32.   "creator": "Twine",
    33.   "creator-version": "2.3.10",
    34.   "ifid": "3ABE2F39-D443-412D-8A53-78A448DA7E24"
    35. }

    In the Dialogue System, add characters to your dialogue database:

    upload_2021-1-7_8-52-6.png

    In the Twine Import window, assign your database and the characters that will be conversation's actor and conversant. In the screenshot below, Char2 is assigned as the actor. Char1 is assigned as the conversant:


    upload_2021-1-7_8-51-55.png

    When you import, the conversation will look like this:

    upload_2021-1-7_8-52-37.png
     
    Froghuto likes this.
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Reminder: The Asset Store's New Year Sale ends today.

    The Dialogue System for Unity is 50% off until midnight PST.

    Quest Machine and Love/Hate are also 50% off until the sale ends.

    upload_2021-1-7_8-58-7.png
     
  17. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Help would be very much appreciated.
    I use Opsive's First Person Controller, Ultimate Inventory system and dialogue system.

    I use this Shop menu opener http://prntscr.com/wijpaz
    If possible, I'd like to make it possible to just click a bool in the editor whether I want the game to pause during the shop or not.

    The creator of ultimate inventory system said it was done through the bridge, but yeah I reckon that doesn't work due to the integration. I am not knowledgeable enough to know my way around other people's code or go into too advanced work just yet..

    So many thanks for any help in regards to this :p
     
  18. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @SOSolacex - I'm checking with Opsive. It may be tomorrow morning when I get an answer because of time zones.
     
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @SOSolacex -

    On the Shop Menu, make sure the Display Panel component's Is Menu Panel checkbox is ticked.

    Also inspect the Display Panel Manager component, typically on a GameObject named Inventory System Canvas. Tick Set Time Scale To Zero When Menu Is Open.

    On your Dialogue System Trigger, untick the Start Conversation action's Pause Game During Conversation if possible. The Converse state should freeze the player's movement during conversations.
     
  20. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Hey Tony, unfortunately all of these things have already been done, without positive result.
     
  21. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    174
    Hello. For some reason after loading the game through easy save(I'm also saving/loading dialogue variables like you advised before), when I try to start the dialogue it shows no text


    And seems that even in dialogue tree, it's stuck on "START" node at this moment. What can be wrong?

     
  22. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @SOSolacex - Is the Sequence running in a conversation, in a Dialogue System Trigger's Actions > Play Sequence, or something else? (Or Dialogue System Trigger Interactable Target, which is a variant of Dialogue System Trigger that works with Opsive's interaction system.)

    If it's a conversation, is the player is paused during the conversation? If so, are you ending the conversation with the OpenShop() node? And, if so, does the player unpauses when this happens?

    Try assigning the NPC (with the Shop component) to the Start Conversation action's Conversation Conversant, and assign the player (with the Inventory component) to the Conversation Actor.

    I'll PM you an example scene. It demonstrates a plain trigger running OpenShop() and a conversation that uses a second trigger set to OnConversationEnd to run OpenShop() when the conversation ends, as I found this was the simplest way to open the shop at the end of the conversation without having to fiddle with UCC settings.
     
    Last edited: Jan 9, 2021
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Stickeyd - What is the Sequence field on that <START> node?

    Are you saving while the conversation is active and then resuming the conversation when the game is loaded? (For example, using a ConversationStateSaver component.)

    Try temporarily setting the Dialogue Manager's Other Settings > Debug Level to Info. Then reproduce the issue. The Console logs may help pinpoint the reason.
     
  24. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    174
    Sequence has None() (the standard for all dialogues STARTs). Here is debug log.



    When I try to press Continue button it just makes the continue button object not active, but doesn't change anything concerning dialogue

    I'm loading the game when dialogue is not active(after quitting it)
     
    Last edited: Jan 9, 2021
  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Stickeyd - 41 errors are being filtered out of the Console. Probably one of those errors indicate the reason why the dialogue is getting stuck. Can you please share those errors, either in a reply or PM?
     
  26. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    174
    Most of these errors are not related to dialogues, it's other problems. There is one error about missing reference exception, which points to Dialogue Manager which may be relevant though. It occurs when I start dialogue. https://gyazo.com/2a3a31f4eaf718958ba8966de6a84c3e

    No idea what exactly is it missing though
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    After loading the game, can you look over the Dialogue Manager GameObject hierarchy and see if anything is obviously missing, such as part of the dialogue UI? Also make sure the Dialogue Manager's DialogueSystemController Dialogue UI field still points to the correct dialogue UI.

    If that doesn't help, would it be possible for you to send a reproduction project and reproduction steps to tony (at) pixelcrushers.com?
     
  28. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    174
    So I researched the issue, and it seems that it occurs because after loading I destroy some other objects and instaniate again their prefabs on scene. These objects/prefabs have Dialogue System Trigger. Could it be that Dialogue Manager has some references to these objects and loses them after reinstaniation?
     
  29. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Here are the references that the Dialogue Manager caches:
    • It will instantiate a dialogue UI if a prefab is assigned to the Dialogue Manager's Dialogue UI field. But it probably isn't destroyed in your reload because it will be instantiated as a child of the Dialogue Manager.
    • If the Dialogue Manager has an Instantiate Prefabs component, it will instantiate the prefabs listed in that component. It doesn't keep reference to any of the instances.
    • If a sequencer camera prefab is assigned to the Dialogue Manager's Camera & Cutscene Settings > Sequencer Camera, it will instantiate it. But the sequencer will check if it's still valid before trying to use it.
    The Dialogue System Trigger auto-refreshes any invalid cached values when used.

    Are you destroying character GameObjects that have Dialogue Actor components? Or are you manually calling CharacterInfo.RegisterActorTransform?

    As a test, before loading a game, try running this code:
    Code (csharp):
    1. var ui = DialogueManager.dialogueUI as StandardDialogueUI;
    2. ui.conversationUIElements.standardMenuControls.ClearCache();
    What version of the Dialogue System are you using? If you're not using 2.2.14, can you back up your project and try updating?
     
  30. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    174
    They do have Dialogue Actor along with Dialogue System Trigger. It's just two enemies with bark. I checked and if I don't try to destroy them before loading, everything works...

    EDIT: Yeah, they do have a Dialogue Actor component, as they are objects that can bark.
     
    Last edited: Jan 10, 2021
  31. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    @Stickeyd - When a Dialogue Actor component is disabled (e.g., when its GameObject is destroyed), it will remove itself from the cache of Dialogue Actors. As a test, can you temporarily remove the Dialogue Actor components from the characters and test the issue? I don't think it will make a difference, but I'm trying to narrow down the possibilities.

    At any time, please feel free to send a reproduction project to tony (at) pixelcrushers.com. It's often the fastest way to resolve issues.
     
  32. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    174
    Removing Dialogue Actor doesn't help.

    My project is huge and I think explaining how properly to download it, start it and reproduce the issue would take even longer than figuring out how to fix it my way
     
  33. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    @Stickeyd - In that case, I think you will need to step through the Dialogue System's code in your debugger to identify the line where it reports the MissingReferenceException. If you can tell me the line, I can probably quickly tell you how to fix it. Try putting breakpoints on ConversationView.StartSubtitle and StandardUISubtitlePanel.SetContent to narrow down how much you need to step through.
     
  34. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Hey, I'll take a look at your DM in a bit, but I'll answer your questions first.
    It's basically the "exit" node of a conversation.
    Example: http://prntscr.com/wkcoi3

    I tried both pausing the player and not pausing the player, neither worked, but yes if it's paused, the player does unpause when the shop gets opened.

    I tried the Actor x Conversant thing, which didn't work.

    I'll take a look at the example scene in a bit and give you an update.
     
  35. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Sounds good! I'm working on an update to the integration that includes a variant of the Converse ability. This variant will be aware of the shop menu so you won't have to wrangle with UCC's systems as much. I'll try to have it available tomorrow.
     
  36. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Hey Tony!
    I've tried the extra dialogue system trigger using the On Conversation End method, however with no positive results. (Same as before)

    I tried loading the example scene, however I wasn't able to actually use it as I use the First Person Controller instead of the Ultimate Character Controller ( I don't have 3rd person view)
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @SOSolacex - I PM'ed you the updated Converse ability. I'll plan to include it in an updated Dialogue System integration package for Opsive.
     
  38. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    174
    So this was a super weird bug, because it turns out that it happens only when I destroy all the destroyed object children...So If I don't destroy the object itself, but destroy all its children, the issue happens. But if I destroy only some of its children, letting only one of them not destroyed, everything works... I even tried to create dummy empty gameobject as a child, and if it stays and is not deleted, everything works after loading...

    I temporarily solved the issue by not destroying the whole object altogether, but rather disabling it and deleting all its children after loading except one dummy child gameobject...All main components are happen to reside on children in my hierarchy, so basically it means that I remove all components in this object structure, only letting empty gameobject with empty child be alive after loading. Not sure if it's a proper solution, but I can't figure out what can be happening and how to solve it other way
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Which object's children are you destroying? Are these Dialogue System-related objects?
     
  40. dev_project

    dev_project

    Joined:
    Jan 31, 2020
    Posts:
    23
    Hey, I've just come across your asset. I'm porting my old game where I had my own scripting language for non-linear narrative and was wondering if you could recommend the best way to export it to your format.
    Basically, I've got Ifs with some complex logical conditions, main loop (basically, just to keep automatically going back to the initial phrases shown depending on the game state) and various custom actions.
    I see that you support importing a variety of different formats and thought you could recommend the path of least resistance.
    Another question: does it heavily rely on Lua internally or is it possible to avoid Lua altogether in run-time? If not, do you have any information about the run-time and memory performance of this system?

    Thank you!
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @DevOnline - Feel free to try the evaluation version.

    The Dialogue System uses traditional branching dialogue trees, where each node can have blocking conditions and/or instructions to do things like set variables:

    upload_2021-1-16_16-14-12.png

    It uses Lua internally for conditions and variables, but you can use it very lightly if you even want to use it at all.

    The core Dialogue System engine is pretty lean. Memory and performance depend on which options you enable. For example, there's an option to record the "visited" status (unvisited, shown as subtitle, or shown in response menu) of every node in every conversation. If you turn it on, it will of course use more memory. By default it's off.

    There are several ways to bring content into the Dialogue System. It ships with a starter template script for writing your own importer window. This template was used to write the official importer windows for Twine, CSV, and other formats. Alternatively, you can create a dialogue database asset manually. It's a plain old serializable ScriptableObject. This post explains how to create a dialogue database in script. Or you can export to any format that's supported by any of the built-in import windows (e.g., Twine JSON, Chat Mapper XML, etc.).
     
    HakJak likes this.
  42. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    174
    Hello. When character appear first, they seem to set one particular color, and then try to focus and set another. This creates weird effect with characters appearing in one color and than changing it to another. I would like to make characters appear already focused/unfocused depending on if it's their dialogue line

    https://gyazo.com/d7679f562444c28ecdd1e5d7c1bcb64c
     
  43. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Hi @Stickeyd - Do you mean that when a conversation starts, the first speaker should appear fully focused instead of fading in from dark to full color?
     
  44. Stickeyd

    Stickeyd

    Joined:
    Mar 26, 2017
    Posts:
    174
    Yes
     
  45. carmofin

    carmofin

    Joined:
    May 13, 2017
    Posts:
    116
    Hi, I have a question...
    I'd like my characters to have multiple portraits with different emotions.
    I have seen you can assign more then one portrait, but I don't see any settings to select one...
    What am I missing?

    edit: Found it in the thread.
     
    Last edited: Jan 21, 2021
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    @Stickeyd - I'll put together an example later today and post it here.

    For completeness: You can show different portraits using:
     
    christh likes this.
  47. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    @Stickeyd - Here is an example exported from Unity 2019.4. Due to the way the default animation handler works, it will the first speaker in the darkened state for 1 frame before showing it in full color.

    If you have to get rid of the 1 frame:
    1. Clear the subtitle panels' Show, Hide, Focus, and Unfocus Trigger fields.
    2. Make a subclass of StandardUISubtitlePanel. Override the Open() and Focus() methods to show the image immediately in full color. You can even use a tweening library such as DOTween instead of an Animator if you prefer. Use this subclass on your subtitle panels instead of StandardUISubtitlePanel.
     

    Attached Files:

  48. weto4ka

    weto4ka

    Joined:
    Feb 8, 2019
    Posts:
    48
    Hi, TonyLi! happy NY 21!
    What do I need to set to start a conversation from another actor / conversant. Now I always have an NPC starting a conversation, and changing the DialogueSystemTrigger Conversation Actor and Conversatin Conversant does not change anything if I change them. I am also trying to change the DialogueActor Actor, but that didn't change anything. NPCs always start a conversation. But I want the Player to start the conversation sometimes. When I manually change the conversant and the actor for Entry, it changes the dialogue, and I can switch between who starts talking, NPS or Player. But it seems to me that there is a more elegant way to do this? Because I want to use the same conversation, working for both, to start it from npc or user and that means that every time I have to switch all my entries to the correct actor / conversant ...
    So what do you recommend to use? Is there some elegant way to switch actor / conversant for the whole conversation without manually switching each actor / conversant for all entries of particular conversation?
     
  49. weto4ka

    weto4ka

    Joined:
    Feb 8, 2019
    Posts:
    48
    How can I get current UI that is now showing (mainly responses panel, I need to check is it's active/open now)? Cause I have now UI for Screen Space and World Space and want to take the one that is currently using for conversation
     
  50. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    I don't understand. Can you provide some pictures?

    If you change the conversation's Actor and Conversant, it will only update the nodes that are assigned to those actors. For example, in the screenbelow, if I change the conversation's Actor to XXX and Conversant to YYY, then the <START> and "Greetings" lines will be assigned to XXX. The "Hello" line will be assigned to YYY. But the Another Actor: "Hi" line will remain assigned to Another Actor.

    upload_2021-1-23_14-12-39.png

    In your Dialogue System Trigger, if you assign the Player and NPC GameObjects:

    upload_2021-1-23_14-16-16.png

    then they will match the conversation:

    upload_2021-1-23_14-17-51.png


    However, if you assign them in the opposite order:

    upload_2021-1-23_14-19-34.png

    then they will play in the conversation like this:

    upload_2021-1-23_14-18-43.png

    To check if any conversation is playing, check DialogueManager.isConversationActive

    To check the current dialogue UI: (DialogueManager.dialogueUI as StandardDialogueUI).isOpen

    To check if any dialogue UI is open, check its isOpen property.