Skip to content

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

Closed

Description

@wangzhenGitHup

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

Activity

  1. self-assigned this
    on Jan 5, 2024
  2. minggo commented on Jan 9, 2024

    @minggo
    Contributor

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

  3. minggo commented on Jan 9, 2024

    @minggo
    Contributor

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

  4. added this to the v3.8.3 milestone on Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions