Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The bug of scheduleOnce not being executed is triggered when scheduleOnce and unschedule are called multiple times. #16653

Closed
wangzhenGitHup opened this issue Jan 3, 2024 · 2 comments
Assignees
Labels
Milestone

Comments

@wangzhenGitHup
Copy link

Cocos Creator version

3.8.0

System information

web windows

Issue description

Repeated calls to scheduleOnce and unschedule significantly increase the likelihood of scheduleOnce no longer triggering. I modified the scheduleOnce function in the engine's source file components.ts to fire on the next frame, which currently resolves this issue. However, I'm unsure if this modification may lead to other problems.
222

Relevant error log output

No

Steps to reproduce

.

Minimal reproduction project

ScheduleOnceBugDemo.zip

@wangzhenGitHup wangzhenGitHup added Bug Needs Triage Needs to be assigned by the team labels Jan 3, 2024
@minggo minggo self-assigned this Jan 5, 2024
@minggo minggo mentioned this issue Jan 9, 2024
6 tasks
@minggo
Copy link
Contributor

minggo commented Jan 9, 2024

When Scheduler.scheduleOnce() finishes, it will unschedule itself, so the schedule action in callback is unscheduled.

@minggo
Copy link
Contributor

minggo commented Jan 9, 2024

I fixed it by using a special unschedule function for timer to fix it.

@minggo minggo removed the Needs Triage Needs to be assigned by the team label Jan 9, 2024
@minggo minggo added this to the v3.8.3 milestone Jan 9, 2024
@minggo minggo closed this as completed Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants