Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

good large scale conversation system

Discussion in 'Scripting' started by brammie15, Jan 1, 2020.

  1. brammie15

    brammie15

    Joined:
    Nov 7, 2017
    Posts:
    6
    hi, I am kinda new to unity.
    So I need a conversation system where the player can answer questions that I give with either "yes" or "no".
    and the yes or no questions need to have different outcomes.for example:

    yes: Ok, so blah blah blah
    is this thing on?
    no: wait how can you answer this then

    and then these questions need to have multiple outcomes,
    but I can't seem to figure this out.
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,594
    What have you tried?
    You could look into asset store.
     
  3. KubesContent

    KubesContent

    Joined:
    Jul 13, 2018
    Posts:
    10
    This sounds like it could be done using ScriptableObjects.

    Code (CSharp):
    1. public class DialogueObject : ScriptableObject
    2. {
    3.  
    4.     [SerializeField]
    5.     private string text;
    6.  
    7.     [SerializeField]
    8.     private DialogueChoice[] dialogueChoices = {};
    9.  
    10.     public string Text => text;
    11.  
    12.     public DialogueChoice[] DialogueChoices => dialogueChoices;
    13.  
    14. }
    15.  
    16. [Serializable]
    17. public class DialogueChoice
    18. {
    19.  
    20.     [SerializeField]
    21.     private string choice;
    22.  
    23.     [SerializeField]
    24.     private DialogueObject proceedingDialogue;
    25.  
    26.     public string ChoiceText => choice;
    27.  
    28.     public DialogueObject ProceedingDialogue => proceedingDialogue;
    29.  
    30. }
     
  4. Laperen

    Laperen

    Joined:
    Feb 1, 2016
    Posts:
    1,065
    Despite how simple it may seem when thought of from screen to screen, having a branching dialogue system is no easy task. Even more so for branching outcomes. For more complex implementations, a node graph is pretty much a necessity. Having the nodes affect objects in your scene will be part 2 of the problem. If you have no experience with editor scripting, it will be far easier for you to pick up an asset that lists the features you want.
     
  5. brammie15

    brammie15

    Joined:
    Nov 7, 2017
    Posts:
    6
  6. Laperen

    Laperen

    Joined:
    Feb 1, 2016
    Posts:
    1,065
    Looks like how you'd do stuff in Ren'py, which is a game engine completely dedicated to making visual novels. Not exclusively of course, other creators have made rather impressive things with it, but pure conversation is what Ren'py excels at. Ren'py doesn't extend itself into 3D, and is script heavy. Other than that, if all you're looking to make is a 2D decision making game, I'd suggest Ren'py as a popular lightweight alternative.