Forum rules - please read before posting.

Player switching during "play in background" dialog breaking

If I switch player while a "play in background" dialog is running, the subtitles UI freezes up and won't update when new dialog starts. Can I reset the subtitles UI somehow during my player switching?

Comments

  • edited March 2021

    The Dialogue: Stop speech Action can be used to force-off all dialogue, but I would like to recreate the issue.

    Which character is speaking the dialogue in question, and does the player-switching result in a scene change?

  • No, there is no scene change. The dialog is said by the active playing character.

    But when I switch character, my previous character is removed from the scene. I guess that's what's causing it? Here's the error I get:

    "MissingReferenceException: The object of type 'AudioSource' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object."

    I'm not sure if that's what's killing the UI but I guess it could be?

  • To clarify. When I switch player, I'm using "Replace old player's position".

  • edited March 2021

    Can you share the error in full, stacktrace included?

  • edited March 2021

    The error is clearly related to the audio being played while the player of the audio disappearing. If I do the exact same thing but play a background dialog WITHOUT a connected audio file, it doesn't hang the subtitles UI.

    If I switch player mid dialog without audio, it merely skips to having the entire dialog printed, as if you pressed a button to skip the dialog. And then it fades away as it's supposed to.

    This is what I get when I DO have audio for the speech:

    No AudioSource found to play speech for null - has their Speech AudioSource been assigned?

    -> AC debug logger
    UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
    AC.ACDebug:LogWarning (object,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:33)
    AC.Speech:UpdateDisplay () (at Assets/AdventureCreator/Scripts/Speech/Speech.cs:293)
    AC.Dialog:_LateUpdate () (at Assets/AdventureCreator/Scripts/Speech/Dialog.cs:105)
    AC.StateHandler:LateUpdate () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:314)

    And:

    MissingReferenceException: The object of type 'AudioSource' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    AC.Speech.UpdateDisplay () (at Assets/AdventureCreator/Scripts/Speech/Speech.cs:308)
    AC.Dialog._LateUpdate () (at Assets/AdventureCreator/Scripts/Speech/Dialog.cs:105)
    AC.StateHandler.LateUpdate () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:314)

    And then it just keeps printing those, one after the other...

  • edited March 2021

    A potential fix: open up Player.cs, and look for the RemoveFromScene function around line 994. At the top of it, insert the following:

    KickStarter.dialog.EndSpeechByCharacter (this);
    

    Does that resolve it?

  • That solved it! Thanks. :smile:

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.