Change continue button sprite on last dialogue

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Strook
Posts: 70
Joined: Fri Nov 08, 2019 10:51 am

Change continue button sprite on last dialogue

Post by Strook »

Hello!

Is it possible to detect in a script if the next dialogue entry will terminate the conversation? I would like to swap the continue button sprite for another when pressing continue will close the dialogue

Thanks!
Currently working on ->Squeakross: Home Squeak Home<- Using Dialogue System Save System and other features.
Previous game made with Dialogue system ->The Spirit and The mouse<-
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change continue button sprite on last dialogue

Post by Tony Li »

Hi,

Yes. Check DialogueManager.currentConversationState.hasAnyResponses. For example, you can add a script with an OnEnable() method to the continue button. Something like:

Code: Select all

public Sprite regularSprite;
public Sprite closeDialogueSprite;

void OnEnable()
{
    if (DialogueManager.isConversationActive)
    {
        GetComponent<Image>().sprite = DialogueManager.currentConversationState.hasAnyResponses 
            ? regularSprite 
            : closeDialogueSprite;
    }
}
User avatar
Strook
Posts: 70
Joined: Fri Nov 08, 2019 10:51 am

Re: Change continue button sprite on last dialogue

Post by Strook »

perfect, thanks a lot!
Currently working on ->Squeakross: Home Squeak Home<- Using Dialogue System Save System and other features.
Previous game made with Dialogue system ->The Spirit and The mouse<-
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change continue button sprite on last dialogue

Post by Tony Li »

Happy to help!
Post Reply