cocos / cocos-engine

Cocos simplifies game creation and distribution with Cocos Creator, a free, open-source, cross-platform game engine. Empowering millions of developers to create high-performance, engaging 2D/3D games and instant web entertainment.
https://www.cocos.com/en/creator
Other
8.73k stars 2.04k forks source link

updateUntil 会导致call执行2次 #17876

Open shker-tt opened 4 days ago

shker-tt commented 4 days ago

Cocos Creator version

3.8.4

System information

editor

Issue description

-

Relevant error log output

No response

Steps to reproduce

import { _decorator, Component, log, tween } from 'cc';
const { ccclass } = _decorator;

@ccclass('Test.UpdateUntil')
export class Test_UpdateUntil extends Component {
    private testNumber = 0
    start() {
        this.startTestTween()
    }

    private startTestTween() {
        log("startTestTween")

        let ended  = false

        tween(this)
            .delay(1)
            .call(()=>{

                tween(this)
                    .delay(1)
                    .call(()=>{
                        ended = true
                    })
                    .start()

                this.testNumber++
                if(this.testNumber > 1) {
                    debugger
                }
            })
            //.delay(1)
            .updateUntil(()=>{
                return ended
            })
            .call(()=>{
                this.testNumber = 0

                this.scheduleOnce(()=>{
                    this.startTestTween()
                }, 0.3)
            })
            .start()
    }
}

Minimal reproduction project

No response