Page 1 of 1

Change continue button sprite on last dialogue

Posted: Wed Sep 29, 2021 10:16 pm
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!

Re: Change continue button sprite on last dialogue

Posted: Wed Sep 29, 2021 10:34 pm
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;
    }
}

Re: Change continue button sprite on last dialogue

Posted: Thu Sep 30, 2021 6:58 pm
by Strook
perfect, thanks a lot!

Re: Change continue button sprite on last dialogue

Posted: Thu Sep 30, 2021 8:17 pm
by Tony Li
Happy to help!