-
I have a use case where I have a Sequence that I'd like to repeat an undetermined number of times, but within a callback, I have some logic where I'd like to be able to stop the same Sequence if some conditions are met, is there an easy way to achieve this? If I try to declare the Sequence and use the reference within the same Sequence, the compiler complains that it's unassigned.
|
Beta Was this translation helpful? Give feedback.
Answered by
Nelvin
Feb 22, 2024
Replies: 1 comment 2 replies
-
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();
}
}); |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
scotsdez
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should work