Skip to content

Cancel a Sequence from within a callback? #52

Answered by Nelvin
scotsdez asked this question in FAQ
Discussion options

You must be logged in to vote

This should work

Sequence autoAdvance = Sequence.Create(cycles: -1, CycleMode.Restart, useUnscaledTime: true).ChainDelay(15f);
autoAdvance.ChainCallback(() =>
{
    if (!playerHasManuallyAdvancedText && CurrentPage < AnswerText.textInfo.pageCount)
    {
        NextPage(false);
    }
    else
    {
        // cancel this current Sequence (autoAdvance) here
        // can't reference autoAdvance here as it is undefined
        autoAdvance.Stop();
    }
});

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@scotsdez
Comment options

@KyryloKuzyk
Comment options

Answer selected by scotsdez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
FAQ
Labels
None yet
3 participants