Page 1 of 1

Timeline / Enabling a Continue Button through Sequences/Messages?

Posted: Fri Apr 16, 2021 12:34 am
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)

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

Posted: Fri Apr 16, 2021 8:53 am
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 221 times

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

Posted: Fri Apr 16, 2021 9:08 am
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?

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

Posted: Fri Apr 16, 2021 9:42 am
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.)