Forum rules - please read before posting.

Dialogue with Sound

edited February 2016 in Engine development

I am little bit confused why I can't find anything here because it seems obvious that this is a important feature but actually I really did not find anything.

So my question / request: 

It would be very very handy if you could extend the Dialogue (play speech) module in the ActionList Editor with a Sound (Play-one-shot) attribute. So that you could display a dialogue and at the same time play an audio file. This can already be done with a single Dialogue and a single Sound Module, but this is twice as much effort especially with huge amounts of dialogues. In addition the option subtitles can be skipped only works on the dialogue you have still to wait for the sound to finish.

With a combined dialogue module you would be able to write better games in fewer time, this would be a great feature.


  • Playing voice files with speech lines is done through the Speech Manager.  By doing it this way, you can also play different files for each translation, make use of lip-syncing, and more.  See the tutorial here.
  • Ah ok thanks, I have tried this and it works. First I had problems to display the subtitles but then I found Show subtitles option in the Settings tab of the AC Game Editor.

    One question which is not covered by the documentation:

    What is the reason why i need the Create script sheet, I have turn the Auto-name speech audio files? off and now i can directly add the audio files in the Speech tab. Also with force Text mode i can see in my Git that this changes are persisted in my SpeechManager.asset file. Is that also a correct approach? I don't like the filenames auto generated for my sound files thats the reason I like this way.
  • The Create script sheet option is there for you to give to voice actors if needed.

    All data related to voice files is kept in the Speech Manager, so that's probably what you're seeing.
  • So i have assigned the Speech with the ID# 0 an audio file. This works fine unless i press gather text. After i have pressed gather text the audio file is removed but the dialogue is still the same.

    Let's say I have a project with assigned audios to the texts and then i need to add later some dialogue I need to press gather text to update the textes and then all references would be lost this seems like a bug or did I still miss a small point here?
  • That could well be a bug.  I'll look into it to find out.
  • Update: Yes, it is.  Apologies that this slipped through the net.  It won't be an easy fix, so I'm afraid you'll have to make do with automatic assigning until I can put an update out.
  • Turns out this is actually quite simple to fix, so you should be able to make the correction manually rather than wait for the update.

    Option up SpeechManager.cs, and find the function named "RestoreTranslations". Insert the following just before the "break;" command:

    line.customAudioClip = tempLine.customAudioClip;
    line.customLipsyncFile = tempLine.customLipsyncFile;
    line.customTranslationAudioClips = tempLine.customTranslationAudioClips;
    line.customTranslationLipsyncFiles = tempLine.customTranslationLipsyncFiles;
  • Thanks for the solution, will this be included in the next update? Right now it is only an issue for further development for me.
  • It will indeed - it's a critical bug!
  • Right now we have created a second scene with many dialogues, when i press gather texts the LineId fields get mixed in the existing content. I have no clue what is wrong... I have added different NPC's in my first scene to build up better dialogues (first only the player did talk) can this be an issue?

    Please can you help? Luckily we have git so infinit tries... but I can't get it running without mixing up the existing content... This was my doubt in the first place about the gather text feature.
  • edited April 2016
    After a closer investigation it seems that only dialogues which are located inside ActionList Files (not in the scene) are mixed up.

    I did a restructure of the folder structure where this files are located when i recall right... 


    After i fixed the speech files for the ActionList file Dialogues, i tried Gather texts again... and now every LineId is +1 ... there seem to be definitely a a bug in the gather texts function.
  • With the new Version 1.51e of the SpeechManager.cs file the problem seems to be solved. Thanks for the quick response I will provide further feedback if something is still going wrong ;)
  • After adding some sounds and working with the new gathering it seem to work, never the less the gather function is changing lineIDs they don't seem to matter because the reference to the sound file seems to be not screwed up but in theory once a lineID is assigned the ID should be fixed and not change during the development cycles...

    In the SpeechManager.asset (Arno is our player Name):

         customTranslationLipsyncFiles: []
         tagID: -1
       - isPlayer: 0
    -    lineID: 540
    +    lineID: 9
         scene: Basement
         text: Arno


         customTranslationLipsyncFiles: []
         tagID: -1
       - isPlayer: 0
    -    lineID: 299
    +    lineID: 540
         scene: Kitchen
         text: Arno

    And in the Player.prefab

       motionControl: 0
       talkingAnimation: 0
       speechLabel: Arno
    -  lineID: 299
    +  lineID: 540
       displayLineID: -1
       speechColor: {r: 0.5735294, g: 0.6823529, b: 1, a: 1}

    Also in the scene files there is always something changed but there i can't see anything through sourceTree (git program)
  • Ok there seem to be another problem as well... I think unity did cover it for some minutes because of reload issues... after I added new mp3 files to a new scene speeches i pressed gather texts again... and now every reference to any sound file was deleted in the SpeechManager.asset file... how can i provide you with more information?
  • An ID number should indeed be fixed once assigned, unless you're using the merge option for matchine lines, but that only applies to speech lines.  The new Speech Manager code I sent will want you if an ID must be reassigned due to a conflict with another.

    Were the changes you posted above the only such changes?  Please correct me if I'm mistaken, but it looks like this is because you're using local prefabs in each scene.  I will have to think on how to solve this, but it should be that this is an isolated exception and not too serious.

    For the audio issue, what are the exact steps you're taking to produe this?  Was this only occuring after the updated SpeechManager.cs file I sent you?
  • edited April 2016
    I can sent you a copy via PN of the commit where you can press gather texts and all audio file assignments are gone, if you want?

    And yes this occurs with the new version of the SpeechManager.cs file.
  • edited April 2016
    I'm assuming you're looking at sending me a Gb+ project, which I'm not so eager to handle.  Please try to answer my questions first:
    1. Again, can you provide steps to reproduce this?
    2. Which audio files are being unassigned, specifically?  Original language or translations?  Are you also assigning lipsync files?
    3. Where are the speech lines that lose their audio assignments / is there a pattern to them / how many?
    4. Are they retaining their ID number, or being changed?
    5. Are they merging with a matching speech line to form just one ID?
  • 1) There is nothing special... i will try to tell you what things are set up.
    a) There are 2 scenes added in the Run Settings
    b) Both scenes have dialogues with mp3 assigned with the SpeechManager (auto-name speech audio files? is turned off)
    c) There are also actionLists which have dialogues for Inventory Items these have also assigned mp3 files
    d) Only the SpeechManager is version 1.51e dev 7

    When i press now gather texts every single audio reference in the SpeechManager.asset is removed. What i found out right now is that if i quit unity and reopen it again the deleted references are gone and the sound files are again assigned. (I did not save but in sourcetree there are changes on filesystem level so i suppose there is some kind of saving in progress, when i save my project the deleted references are also there again) I think it is only a problem if you gather texts and commit this to git directly...

    After starting Unity again the files i described on the 22 April are modified.

    2) All Audio files, only original language we don't have translations and no lipsync files.
    3) All Audio References
    4) They are retaining their ID 
    5) I am not sure i don't think so

  • There is also an warning while gathering texts:

    Conflicting ID number (540) found with 'Arno'. Changing to 299.

    UnityEngine.Debug:LogWarning(Object, Object)
    AC.ACDebug:LogWarning(Object, Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:26)
    AC.SpeechManager:SmartAddLine(SpeechLine) (at Assets/AdventureCreator/Scripts/Managers/SpeechManager.cs:1087)
    AC.SpeechManager:ExtractCharacter(Char, Boolean) (at Assets/AdventureCreator/Scripts/Managers/SpeechManager.cs:711)
    AC.SpeechManager:GetLinesFromSettings(Boolean) (at Assets/AdventureCreator/Scripts/Managers/SpeechManager.cs:1183)
    AC.SpeechManager:PopulateList() (at Assets/AdventureCreator/Scripts/Managers/SpeechManager.cs:577)
    AC.SpeechManager:ShowGUI() (at Assets/AdventureCreator/Scripts/Managers/SpeechManager.cs:264)
    AC.AdventureCreator:OnGUI() (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:222)

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.