Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[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:
    10,554
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Dialogue System for Unity version 2.1.0 Released

    Version 2.1.0 is now available on the Pixel Crushers customer download site (PM me your Unity Asset Store invoice number if you need access) and should be available on the Unity Asset Store soon.

    Version 1.8.8 is also available on the customer download site.

    Version 2.1.0 Release Notes
    Core:

    • Dialogue Editor:
      • Improved: Conversation title dropdown now fills available width of window to accommodate long titles.
      • Improved: Added Menu > Delete Conversation (alternative to right-click context menu).
      • Fixed: Newly created conversations sometimes didn’t appear in node editor.
    • Improved: Dialogue database reset/save/load performance optimization.
    • Improved: Added public accessors for ConversationModel’s cached display settings values.
    • Improved: Standard UI panels can now animate using legacy Animation as well as Mecanim Animator.
    • Fixed: LookAt() sequencer command rotation bug.
    • Fixed: ShowAlert(message,duration) now handles newline codes like ShowAlert(message).
    • Fixed: Float to string conversation is now culture invariant when using .NET4.
    Third Party Support:
    • Inventory Engine: Added DialogueSystemInventoryEventListener.SetEventSystemNavigationEvents and SetInventoryInputManager to allow UI input outside of Inventory Engine.
    • Opsive Controllers: DialogueSystemInteractableTarget sets player as interactor if none specified; Can have multiple targets; Added uccLookAt() sequencer command; UCCSaver now observes spawnpoint for characters tagged as Player.
     
    treshold likes this.
  3. Izzow

    Izzow

    Joined:
    Dec 17, 2017
    Posts:
    4
    Hey guys!

    I'm new to Dialogue System and read a lot of documentation, but I still can't find a way to do what I'd like to do...

    Is it possible to create Actors at runtime?

    Thanks!
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @Izzow - Thanks for using the Dialogue System!

    Yes, there are a few ways you can create actors at runtime.

    1. Set up a general purpose actor and re-use it. For example, let's say you want to re-use the same general-purpose shopkeeper conversation to talk with shopkeepers in every town. In your dialogue database, define an actor named Shopkeeper and use it in your general-purpose shopkeeper conversation. In each town, add a Dialogue Actor component to the town's shopkeeper, click the circle next to the Actor field, and type in that shopkeeper's name. You can use the [var=Conversant] markup tag in dialogue text to show the name, such as:
    • Dialogue Text: "Hi, I'm [var=Conversant]. Welcome to my shop in [var=CurrentTown]!"
    Sequencer commands such as "Camera(Closeup)" will also use the correct GameObject.

    This is the easiest way to handle it without any code.


    2. Or re-use the same actor and change its runtime Display Name value. In C#:
    Code (csharp):
    1. DialogueLua.SetActorField("Shopkeeper", "Display Name", "Frederick");
    There are equivalent visual scripting actions for PlayMaker, Bolt, etc.


    3. Or actually add a new actor. To do this, you need to create a DialogueDatabase asset containing the actor, and then add it using DialogueManager.AddDatabase(). Here's example code:
    Code (csharp):
    1. // Create database:
    2. var database = ScriptableObject.CreateInstance<DialogueDatabase>();
    3.  
    4. // Create a template, which provides helper methods for creating database content:
    5. var template = Template.FromDefault();
    6.  
    7. // Create actor:
    8. int newActorID = 999; // Choose some number guaranteed not to be already used.
    9. database.actors.Add(template.CreateActor(newActorID, "Frederick", false));
    10.  
    11. // Add it to the runtime environment:
    12. DialogueManager.AddDatabase(database);
    That code is adapted from this post, which contains code that shows how to create a dialogue database containing actors and a conversation, and start that conversation.
     
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Dialogue System for Unity 2.1.0 now on Asset Store

    Version 2.1.0 is now available for download on the Asset Store!

    It's also in the Asset Store's Best of 2018 Holiday Sale, so you can currently get it for 50% off. If you're also interested in Quest Machine, I've set up an "upgrade" price as a thank-you for Dialogue System users. If you already have a license for the Dialogue System, you can get Quest Machine at 50% off, too.


    If you're using vis2k's uSurvival, the Dialogue System Extras page has an important update to the integration package. (The Extras page also has all kinds of free goodies such as a free main menu/pause menu/save menu system, visual novel starter framework, CYOA framework, VR example, etc.)
     
  6. Treiger

    Treiger

    Joined:
    Mar 20, 2013
    Posts:
    19
    Hi, so I was intrigued by the inclusion of Ink support as I have been trying to integrate it into Unity myself. However, one issue I ran into was localization. Does this system's localization work with the Ink integration?
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @Treiger - Unfortunately no. Unlike the integrations for other external formats such as articy:draft and Chat Mapper, Ink is so different that the Dialogue System lets Inkle's Ink Unity Integration run the data model. For Ink, the Dialogue System integration serves as a UI front-end and provides extra functionality such as the save system, onscreen alerts, quests, and cutscene sequences. Here are some links with more info:
     
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Lurking-Ninja likes this.
  9. MoFaShi

    MoFaShi

    Joined:
    Oct 25, 2015
    Posts:
    35
    I bought this asset six months ago, but I have not been using it yet. because it does not support multi-language. and it seems like you don't have the plan to support this in a short time.
    so I wonder can I change my Dialogue System's license to Quest system? I found that one supports multi-language.
     
  10. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @MoFaShi - The Dialogue System for Unity has the most comprehensive multi-language support on the Asset Store.

    Here is the documentation on multi-language localization: Localization

    Here is a tutorial: Localization Tutorial

    It can also export and import languages from CSV (Excel/Google Sheets): Localization Import/Export

    And if that's not enough, it also supports i2 Localization: i2 Localization Integration
     
    Rotary-Heart likes this.
  11. Maddrax

    Maddrax

    Joined:
    Apr 30, 2016
    Posts:
    1
    Hi,
    The function ClientLocalPlayer() has changed by usurvival and the integration package does not work anymore. Is there a quick hotfix fpr the plugin so both are working together?
     
  12. MoFaShi

    MoFaShi

    Joined:
    Oct 25, 2015
    Posts:
    35
    Oh. I have some wrong memory or you have done this finally. anyway, it is great.
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    No worries! Maybe you were thinking of a different asset. The Dialogue System for Unity has had multi-language support since 2013, as seen in many popular games such as Crossing Souls, The Last Door, Bolt Riley, and others.

    Hi @Maddrax - You can download the updated package on the Dialogue System Extras page. Note that there are two versions of the package -- one for uSurvival 1.29, and one for uSurvival 1.28. If uSurvival's Database.cs file or the Scripting Define Symbols get overwritten, remember to follow the addon's Configuration steps to set it up again.
     
  14. Candy-Bomber

    Candy-Bomber

    Joined:
    May 21, 2015
    Posts:
    64
    Hey, quick question please. Using the "JRPG Template Standard Dialogue UI" how can I have responses in the response panel be listed next to each other in a grid instead of just vertically?

    So the player's possible response choices would line up in the viewport content area like

    A-B-C
    D-E-F

    Instead of

    A
    B
    C
    D
    E
    F?

    Thank you for your time. Regards
     
  15. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @Candy-Bomber - Replace the Content's Vertical Layout Group with a Grid Layout Group:

    upload_2018-12-26_8-18-17.png
     
    Candy-Bomber likes this.
  16. Candy-Bomber

    Candy-Bomber

    Joined:
    May 21, 2015
    Posts:
    64
    Thank you, that did the trick.

    I have one more question. Sorry to be a bother during the holidays, unfortunately I can't find any documentation on this. I have the player's current and maximum HP as two normal Dialogue System variables and I want to connect it to a Unity UI slider to make a health bar. Could you please offer any guidance on how this would work?

    Thank you for your time as always.
     
  17. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    To read a Dialogue System variable, use DialogueLua.GetVariable. Example:
    Code (csharp):
    1. using PixelCrushers.DialogueSystem;
    2. ...
    3. int currentHP = DialogueLua.GetVariable("Current HP").asInt;
    4. currentHealthSlider.value = currentHP;
    If you want the UI slider to automatically update whenever the variable's value changes, there are two ways:

    1. The terribly inefficient way is to use a Lua Observer. These are perfectly fine to use if you set the frequency EveryDialogueEntry or EndOfConversation, but try to avoid using EveryUpdate whenever possible.

    2. It's better to define a C# method and register it with Lua. For example, let's say your C# method is this:
    Code (csharp):
    1. void SetCurrentHP(double x)
    2. {
    3.     DialogueLua.SetVariable("Current HP", x);
    4.     currentHealthSlider.value = (int)x;
    5. }
    Use Lua.RegisterFunction() to make SetCurrentHP() available to Lua. In your dialogue entries' Script fields, use SetCurrentHP() instead of directly changing Variable["Current_HP"].
     
    Candy-Bomber likes this.
  18. Candy-Bomber

    Candy-Bomber

    Joined:
    May 21, 2015
    Posts:
    64
    Thank you. I've managed to get this working by scratching together the following simple script. It's probably not the most efficient, but nothing has exploded just yet. Thought I'd share it in-case anyone else might find it useful.

    "HPBar"
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. using PixelCrushers.DialogueSystem;
    6.  
    7. public class HPBar : MonoBehaviour {
    8.  
    9.    public Slider HP;
    10.  
    11.    void Update() {
    12.  
    13.        HP.value = DialogueLua.GetActorField("Player", "HP").AsInt;
    14.        HP.maxValue = DialogueLua.GetActorField("Player", "MAXHP").AsInt;
    15.    }
    16. }
    Requirements are a non-intractable bottom to top slider called "HP" with the script attached (make sure to set the slider field in the inspector) and a Dialogue System actor called "Player" with a number variable called "HP" for your current health and a number variable called "MAXHP" for your current maximum health. :)
     
    Last edited: Dec 26, 2018
    TonyLi likes this.
  19. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Last Weekend of Best of 2018 Holiday Sale

    This is the last weekend of the Asset Store's Best of 2018 Holiday Sale.

    The Dialogue System for Unity is 50% off in the sale.
     
  20. drimizi

    drimizi

    Joined:
    Dec 21, 2018
    Posts:
    7
    Hello, quick question if I may. I am using both your DS as well as UFPS and I am having an issue with the save/load game system. The first time after I load the game, I can save and load just fine. However, after I load the saved game, I am unable to load any game again. It does not load the previous save or a new one, it just does nothing. I just started teaching myself unity two weeks ago, so I'm sure I messed something up somewhere, it's just odd that it works the first time and then nothing. Any idea of a general area where I might have gone wrong that I can focus looking at? Thanks.
     
  21. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @drimizi - Thanks for using the Dialogue System! Are you using UFPS version 1 or UFPS version 2?

    In your project, does saving & loading work correctly with the included example scene? For UFPSv1, the scene is named "UFPS Example". For UFPSv2, the scene is named "Opsive UCC Dialogue Example".

    Are there any errors or warnings in the Unity editor's Console window?
     
  22. drimizi

    drimizi

    Joined:
    Dec 21, 2018
    Posts:
    7
    I am using UFPSv2, no errors or warnings in the console window. The example scene does work correctly. So with the debug turned on it appears neither the save or load button does anything after I load a save game for the first time. I can save multiple times until I load the save, then neither the save or load works. Also if I die, the save button no longer works and the load button doesn't work, even if I have not used the load button at all yet. I copied the exact settings for the save components from the demo scene but it didn't change any results.

    upload_2018-12-29_15-5-6.png
     
  23. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    How are your save and load buttons set up? Using a UI like in the example scene? Or input buttons, such as F5 and F6?
     
  24. drimizi

    drimizi

    Joined:
    Dec 21, 2018
    Posts:
    7
    I made a basic ui pause menu with a Save and a Load button. Both using the same slot. Tried using both slot 0 and slot 1. After loading a game or dying, the other buttons on the menu work (resume, exit to main menu) but no response at all from save/load.
     

    Attached Files:

  25. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Are the Dialogue Manager's Don't Destroy On Load and Allow Only One Instance checkboxes ticked? (They're ticked by default.)

    After loading a game or dying, please inspect your UI button. Let me know if the OnClick() event is still assigned.

    Feel free to send a copy of your project to tony (at) pixelcrushers.com if you'd like. I'll be happy to take a look directly.
     
  26. drimizi

    drimizi

    Joined:
    Dec 21, 2018
    Posts:
    7
    The "Dont Destroy" and "allow one instance" are both ticked. You were correct, the OnClick event is gone after loading, it also disappears after death.
     
  27. drimizi

    drimizi

    Joined:
    Dec 21, 2018
    Posts:
    7
    Ah ha! I had to make my canvas a child object of the dialogue manager. Everything works much better now. Thanks for your assistance!
     
    TonyLi likes this.
  28. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    I was just about to suggest that. I prefer to keep things organized under the Dialogue Manager, but another option would have been to add a DontDestroyGameObject component to it. This would also keep it around and properly linked to the Dialogue Manager's components. Anyway, glad it's working now!
     
  29. drimizi

    drimizi

    Joined:
    Dec 21, 2018
    Posts:
    7
    I'll keep that in mind for future objects I want to preserve.
     
  30. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    I forgot to mention another alternative for this specific case (saving & loading). You can add a Save System Methods component to your UI button, and use its SaveSystemMethods.SaveToSlot and LoadFromSlot methods. This component will automatically connect to the Save System at runtime so you don't need to keep assignments across different GameObjects.
     
  31. drimizi

    drimizi

    Joined:
    Dec 21, 2018
    Posts:
    7
    Interesting. This is why I love coding, so many solutions to a problem. Thanks again for all of your help.
     
  32. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
  33. Candy-Bomber

    Candy-Bomber

    Joined:
    May 21, 2015
    Posts:
    64
    Hey again, I have another small problem please. I'm testing my text-based project which has some rather lengthy dialogue nodes. Some particularly long dialogue nodes list this error when play-testing.


    ArgumentException: Mesh can not have more than 65000 vertices
    UnityEngine.UI.VertexHelper.FillMesh (UnityEngine.Mesh mesh) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Utility/VertexHelper.cs:206)
    UnityEngine.UI.Graphic.DoMeshGeneration () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Graphic.cs:591)
    UnityEngine.UI.Graphic.UpdateGeometry () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Graphic.cs:573)
    UnityEngine.UI.Text.UpdateGeometry () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Text.cs:571)
    UnityEngine.UI.Graphic.Rebuild (UnityEngine.UI.CanvasUpdate update) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Graphic.cs:534)
    UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/CanvasUpdateRegistry.cs:198)
    UnityEngine.Canvas:SendWillRenderCanvases()


    I'm guessing the dialogue text is too long for the subtitle text game-object? Would putting said game-object inside of a scrollview game-object resolve this issue? How would I go about doing that? I tried creating a scrollview and just putting the subtitle text inside of the content field, but that didn't seem to do the trick.

    Ideally I would prefer not to split the nodes into several smaller ones if it can be avoided, as they are intended to be particularly long.

    Thank you for your time as always. Happy new year. Regards
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @Candy-Bomber - Unity UI is the limiting factor. UI Text is limited to 65000 vertices. (It's actually worse than that. I'm pretty sure the whole canvas is limited to 65000 vertices.) If you use Outline or Shadow effects, this multiplies the number of vertices the text uses. You might be able to double or quadruple the length of text by removing these effects. Or switch to TextMesh Pro, which doesn't have this limit. (See TextMesh Pro Support.)
     
    Candy-Bomber likes this.
  35. Candy-Bomber

    Candy-Bomber

    Joined:
    May 21, 2015
    Posts:
    64
    Thank you, that fixed the issue pretty much instantly. The only problem I have now is the Typewriter effect.

    The linked documentation states that one should replace the Unity UI Typewriter Effect with a Text Mesh Pro Typewriter Effect. However this script can not be found via the inspector's add component button. Digging through the Dialogue System's asset folder I found said script inside the UI Utility sub-folder but trying to manually add it to the Subtitle Text game-object results in the following error window appearing.

    Code (CSharp):
    1. Can't add script component
    2. 'TextMeshProTypewriterEffect' because script
    3. class cannot be found. Make sure that there are no
    4. compile errors  and that the file name and class match.
    Can you please let me know what I am doing wrong?

    Thank you for your time.
     
    Last edited: Jan 3, 2019
  36. Chesney

    Chesney

    Joined:
    Jan 31, 2016
    Posts:
    9
    Hi there,
    First of all I am super happy with my purchase. It took no time at all to get quest machine added to my project.
    I did however find the third party add on for emerald A.I. and Inventory Engine. I imported the common files first like instructed but Inventory engine is giving me errors for methods and variables in Inventory class.

    Assets/Pixel Crushers/Common/Third Party Support/Inventory Engine Support/Scripts/InventoryEngineUtils.cs(115,30): error CS1061: Type `Inventory' does not contain a definition for `GetQuantity' and no extension method `GetQuantity' of type `Inventory' could be found. Are you missing an assembly reference?

    The name space has been included in class, there is no error creating and inventory instance, but cannot find references to Content,UnEquipItem and 12 other similar cases from same class.

    any help would be appreciated.

    best regards,

    Steven.
     
  37. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @Candy-Bomber:
    1. In the Project view, right-click Plugins / Pixel Crushers / Dialogue System / Scripts / UI Subsystem / UI Utility / TextMeshProTypewriterEffect and select Reimport.
    2. Then right-click Plugins / Pixel Crushers / Dialogue System / Wrappers / UI Subsystem Wrappers / UI Utility Wrappers / TextMeshProTypewriterEffect and select Reimport.
    You should then be able to add the Text Mesh Pro Typewriter Effect.

    (This sometimes happens when first enabling Text Mesh Pro support because of a combination of compilation order issues since TextMesh Pro is managed by Unity's Package Manager, the Dialogue System is in Plugins for faster compilation, and it uses wrappers to allow switching between source and DLLs without losing any work.)

    Hi Steven - I'm going to move my reply to the Quest Machine thread. Here's a direct link: reply.
     
    Last edited: Jan 3, 2019
    Candy-Bomber likes this.
  38. Candy-Bomber

    Candy-Bomber

    Joined:
    May 21, 2015
    Posts:
    64
    Thanks, everything is working now. Just wanted to report the following minor issue, not sure if it's a bug or not but I thought I would throw it out there in case you haven't seen it yet.

    Say we have an Dialogue System actor, for this example named "Evil Bob". And we then create a new Dialogue System variable called "CurrentEnemy" set to the actor type, proceeding to select our "Evil Bob" actor for it's initial value. Evil Bob is our fourth actor, so he is listed as '[4]Evil Bob' in the initial value selection drop-down.

    Say we then create a dialogue node saying the following -

    "[var=CurrentEnemy] is in front of you."

    Instead of saying

    "Evil Bob is in front of you." it will say "4 is infront of you"

    Not really a biggie and easy to work around. Just kind of annoying is all.

    Thank you for your time, regards.
     
  39. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @Candy-Bomber - That's by design. If the type is Actor, then it stores the actor's ID number. This allows the Dialogue System to efficiently look up actors by ID as it runs conversations. If Evil Bob is the conversation's conversant, you could use [var=Conversant] instead.

    If you need to translate an actor ID into its display name, you can add the script below to your Dialogue Manager. Then use this markup tag: [lua(GetActorName(Variable["CurrentEnemy"]))]

    MyCustomLuaFunctions.cs
    Code (csharp):
    1. using UnityEngine;
    2. using PixelCrushers.DialogueSystem;
    3.  
    4. public class MyCustomLuaFunctions : MonoBehaviour
    5. {
    6.     void Awake()
    7.     {
    8.         Lua.RegisterFunction("GetActorName", this, SymbolExtensions.GetMethodInfo(() => GetActorName((double)0)));
    9.     }
    10.  
    11.     public string GetActorName(double id)
    12.     {
    13.         return CharacterInfo.GetLocalizedDisplayNameInDatabase(DialogueManager.masterDatabase.GetActor((int)id).Name);
    14.     }
    15. }
     
    Candy-Bomber likes this.
  40. arie1994

    arie1994

    Joined:
    Jun 30, 2016
    Posts:
    71
    how do I add custom variables to save file?
    I have an inventory that is a list of item class and i want to save it
     
  41. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @arie1994 -
    1. Make a copy of Plugins / Pixel Crushers / Common / Templates / SaverTemplate.cs and rename it (e.g., InventorySaver.cs).
    2. Edit the script. Change the class name to match your script name (e.g., InventorySaver). In the RecordData() method, add code to return a string representation of your item list. In ApplyData(), add code that turns the string representation back into your item list. The comments in these methods describe some helpful utility methods that you can use. For an example, see Plugins / Pixel Crushers / Common / Scripts / Save System / Savers / PositionSaver.cs.
    3. Add the script to your inventory GameObject.
     
  42. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Updated Support Packages Available for Standard Usable UI, Corgi, NGUI, uMMORPG, uSurvival

    The Dialogue System Extras page has a small patch for the Selector Use Standard UI Elements component. (Expand "Updated Support Packages for 2.1.0" to access the download link.) It fixes a bug when using Standard Usable UI components on usable GameObjects. And if those previous two sentences don't sound like anything familiar, you can probably skip the patch. :) The fix will also be in the next regular update.

    The Extras page also has updated integration packages for Corgi Platformer Engine, NGUI, uMMORPG, and uSurvival.

    ---

    Witch Hunt on Steam

    Check out prolific dev Andrii Vinsevych's latest horror game, Witch Hunt, on Steam, made with the Dialogue System and getting great reviews:

     
  43. Alic

    Alic

    Joined:
    Aug 6, 2013
    Posts:
    115
    Show NPC Subtitles With Responses toggle on DialogueManager seems to be broken? Unchecking it doesn't cause the npc subtitle panel to go away while selecting a player response.

    Basic Standard Dialogue UI
     
  44. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @Alic - When you're using the Standard Dialogue UI system, the subtitle panel's Visibility setting takes precedence over this checkbox:

    upload_2019-1-8_9-7-19.png

    It gives you more control over when the subtitle is visible. You may want to set it to Only During Content.
     
    Alic likes this.
  45. Alic

    Alic

    Joined:
    Aug 6, 2013
    Posts:
    115
    Aha! Awesome, thanks Tony. If I want to display the npc subtitle in a different place when there are player responses on screen (say, the npc subtitle moves from the bottom of the screen with no responses to the top of the screen when responses are displayed) how would I do that? I think in the old dialoge UI there was a reference for the reminder panel which was different from the normal npc subtitle panel. How do I get that behavior?
     
  46. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi @Alic - Add the script below to your dialogue UI, and assign a panel. I've also attached an example scene with the script.

    Most people disliked the reminder panel and felt like it added unnecessary complexity.. They preferred to have the Visibility dropdown options instead, so I removed the reminder panel from the Standard Dialogue UI. The script below adds that functionality back in.

    Code (csharp):
    1. using PixelCrushers.DialogueSystem;
    2. using UnityEngine;
    3.  
    4. public class ReminderPanelHandler : MonoBehaviour
    5. {
    6.     public StandardUISubtitlePanel reminderPanel;
    7.  
    8.     void OnConversationLine(Subtitle subtitle)
    9.     {
    10.         if (reminderPanel.isOpen) reminderPanel.Close();
    11.     }
    12.  
    13.     void OnConversationResponseMenu(Response[] responses)
    14.     {
    15.         reminderPanel.ShowSubtitle(DialogueManager.currentConversationState.subtitle);
    16.     }
    17. }

    In the example scene, I copied the Basic Standard Dialogue UI and made a copy of the NPC Subtitle Panel called NPC Subtitle Reminder Panel, which I assigned to the ReminderPanelHandler script.
     

    Attached Files:

    Alic likes this.
  47. Alic

    Alic

    Joined:
    Aug 6, 2013
    Posts:
    115
    Rock on, thanks Tony!

    Definitely makes sense to have it as an extra component option to keep the main components less cluttered. Love the new cleaner ui approach!
     
    TonyLi likes this.
  48. GrumpyBear33

    GrumpyBear33

    Joined:
    Jan 25, 2014
    Posts:
    7
    Hey!

    Is there a way to add conversations to an already existing database, while in editor mode?

    I've been trying to play around with it (based on some code posted in this forum for runtime conversation creation) but it seems to be giving me null errors on some Fields (like conversation.Title) when I try to assign those through an editor script. If I skip them it goes fine until I do "DialogueDatabase.AddConversation (conversation);". Then it says "value can't be null".

    Basically, we are using I2 Localization in our game, and I want a way for my writer to be able to work directly in our Google Sheet with all our text, add lines and stuff, and then when I re-import in the database it recreates the entries if he added / removed any. Which the DS to I2 tool doesn't seem to support.

    Also the naming when pushing to I2 from database is chaos when you get to a certain amount of lines.

    We're in Unity 2018.3 and I believe Dialogue System is up to date with the asset store version.


    So is this possible? Thanks!

    P.S.: (sorry if this has been asked already I couldn't find anything with the search)

    Code (CSharp):
    1.  
    2.                     conversation = new Conversation ();
    3.                     conversation.Title = m_Titles[i];
    4.                     conversation.id = m_ConvIDs[i];
    5.  
    6.                     Conversation startEntry = new DialogueEntry ();
    7.                     startEntry.conversationID = conversation.id;
    8.                     startEntry.id = 0;
    9.                     conversation.dialogueEntries.Add (startEntry);
    10.  
    11.                     m_LastEntry = startEntry;
    12.  
    13.                     for (int j = 0; j < m_EntryIDs.Count; j++)
    14.                     {
    15.                         if (m_ConvIDs[j] != conversation.id)
    16.                         {
    17.                             continue;
    18.                         }
    19.  
    20.                         DialogueEntry currentEntry = new DialogueEntry ();
    21.                         currentEntry.conversationID = conversation.id;
    22.                         currentEntry.id = m_EntryIDs[i]+1;
    23.                         currentEntry.DialogueText = "Whatever";
    24.                         conversation.dialogueEntries.Add (currentEntry);
    25.  
    26.                         m_LastEntry.outgoingLinks.Add (new Link (conversation.id, m_LastEntry.id, conversation.id, currentEntry.id));
    27.  
    28.                         m_LastEntry = currentEntry;
    29.                     }
    30.  
    31.                     DialogueDatabase.AddConversation (conversation);
    32.                
     
    Last edited: Jan 9, 2019
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,554
    Hi! Use the Template class to create conversations, dialogue entries, etc. In editor code, you can use TemplateTools to create an instance of the Template class that uses any custom fields you've defined in the Dialogue Editor's Template section. For example:

    Code (csharp):
    1. var template = TemplateTools.LoadFromEditorPrefs();
    2.  
    3. var conversation = template.CreateConversation(uniqueConversationID, "Conversation Title");
    4.  
    5. var startEntry = template.CreateDialogueEntry(0, conversation.id, "START");
    6. conversation.dialogueEntries.Add(startEntry);
    The Template class sets up each object properly, such as creating the default fields for conversations and dialogue entries.

    This forum post contains example code to create a database at runtime. Your code will be similar, minus the top and bottom parts that add the database at runtime and play a conversation.
     
  50. MoFaShi

    MoFaShi

    Joined:
    Oct 25, 2015
    Posts:
    35
    00000.png 00001.png


    I have asked a question about how to localize an NPC name in Dialogue System forum, but I don't know how to insert an image in your forum, so I posted my question here.

    you can see I tick the Use Display Name option, but it is still showing the default name. I can't see where the problem it is.
     
unityunity