Timeline / Enabling a Continue Button through Sequences/Messages?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
SystemId
Posts: 30
Joined: Thu Aug 08, 2019 1:31 pm

Timeline / Enabling a Continue Button through Sequences/Messages?

Post by SystemId »

I am having some problems with Disabling and Enabling a Continue Button.

I have added a Continue Button on my Bark, so my Bark now waits for me to click that to Finish the Bark.

To prevent a Person from Mashing the continue button (Which would screw up my Timeline) Conversation or a Bark, I am setting the Continue button to Disable itself after pressing to continue.

A problem with this is that a have many Objects with the Continue button named the same, name. (They are all the same prefabs)

Originally I tried the Sequence Command:
SetActive(ContinueButton, true);

but it would only show the first ContinueButton in the Hierarchy.
Is there a better way to Disable and Enable a continue button Either through Sequences or Messaging?
I couldn't find much info about the Message Events component, although that might not be the way to go in the first place...

Ultimately I want my Timeline Sequence Clip to be able to enable a Continue button somehow. (Not on the same Game Object)

If anyone knows a solid solution, please share with me : 1 (Especially if my method is not the correct way to do this)
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Timeline / Enabling a Continue Button through Sequences/Messages?

Post by Tony Li »

Hi,

Can you set the continue button's OnClick() event to disable the button?

continueButtonDisableSelf.png
continueButtonDisableSelf.png (31.01 KiB) Viewed 229 times
SystemId
Posts: 30
Joined: Thu Aug 08, 2019 1:31 pm

Re: Timeline / Enabling a Continue Button through Sequences/Messages?

Post by SystemId »

Sorry, I think I confused you with my text wall.
I already disable the button / gameobject on click.
What I want is to re enable it from a timeline / conversation. via a Sequence or Message. Ideally something I can put into a Sequence Clip in a Timeline.

I cannot use SetActive because there are multiple gameObjects in the scene with the same name. Maybe a dozen?
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Timeline / Enabling a Continue Button through Sequences/Messages?

Post by Tony Li »

Oops, I see. I totally misread that.

At what point can the player mash the continue button? The continue button should only appear when it's valid to click it. If you configure the continue button's OnClick() to deactivate its GameObject, then the next time it's valid to show the continue button, the Dialogue System will automatically reactivate it.

Alternatively, if you need more control, you can write a custom sequencer command that looks for the button on the current speaker. For example:

Code: Select all

public class SequencerCommandEnableSpeakerContinueButton : SequencerCommand
{
    void Awake()
    {
        // Enable speaker's bark UI continue button:
        speaker.Find("Continue Button").GetComponent<Button>().enabled = true;
        Stop();
    }
}
(If you don't want to use Transform.Find, you could add a script that has a reference to the continue button.)
Post Reply