Forum rules - please read before posting.

Using the dialogue system in the messaging application

I want to change the look of the dialogue system. I will do this with Unity UI. I want it to look like a messaging app (eg Whatsapp).

Example Video: https://streamable.com/0w2syg

I want to do this with the dialogue system of AC.

Comments

  • The special effects like bubble-wraps around the dialogue, animation and character icons would require a fair amount of custom scripting. If you're not familiar with coding, I would recommend looking to see what dedicated assets are out there for such an effect.

    To do it with AC through scripting though, you would first need to hook into the OnStartSpeech custom event - as covered in this tutorial - to extract the speech text and speaking character when a new speech line is played.

    The most basic method would be to simply take the speech text, and the character name, and add them to your Unity UI Text box. If you record the last character to speak, you can limit the name from showing only when a new character starts speaking. Here's an example script - attach it to your UI and assign the Text box in the Inspector:

    using UnityEngine;
    using UnityEngine.UI;
    using AC;
    
    public class MessagingExample : MonoBehaviour
    {
    
        [SerializeField] private Text textBox = null;
        private Char lastSpeaker;
    
    
        private void OnEnable ()
        {
            EventManager.OnStartSpeech += StartSpeech;
            textBox.text = string.Empty;
            lastSpeaker = null;
        }
    
        private void OnDisable ()
        {
            EventManager.OnStartSpeech -= StartSpeech;
        }
    
    
        private void StartSpeech (AC.Char character, string lineText, int lineID)
        {
            if (character == null) return;
    
            if (!string.IsNullOrEmpty (textBox.text))
            {
                textBox.text += "\n";
            }
    
            if (lastSpeaker != character)
            {
                lastSpeaker = character;
                textBox.text += "\n (" + character.GetName (Options.GetLanguage ()) + ")\n";
            }
    
            textBox.text += lineText;
        }
    
    }
    
  • Thanks @ChrisIceBox I will try the third method.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.