scheduleOnce gone

scheduleOnce gone
0.0 0

#1

Now that scheduleOnce is gone, how do we go about scheduling something one time and then running another callback once that schedule is done?


#2

you can use javascript setTimeout call, or do it through actions:

someActiveNode.runAction(cc.sequence(
cc.delayTime(timeout),
cc.callFunc(callback),
))

#3

thanks, i’d rather avoid setTimeout

your solution looks like a good one,

I’ve also done this -

cc.director.getScheduler().schedule(() => myfunc(parameter), this, 0, 0, 0, false);
function myfunc(paramter) {
    /* code*/
    callback()
}
function callback () {}

#4

apparently I was wrong also about scheduleOnce being removed, as I found it’s still possible to use it via the cc_Component class and anything that extends it