Node的scheduleUpdate和update的关系?

我看了api的文档

scheduleUpdate

Schedules the “update” method.

It will use the order number 0. This method will be called every frame. Scheduled methods with a lower order value will be called before the ones that have a higher order value. Only one “update” method could be scheduled per node.

update

Update method will be called automatically every frame if “scheduleUpdate” is called, and the node is “live”.

  1. 是说如果在调用“scheduleUpdate”之前,“update”不会被调用吗?
  2. “scheduleUpdate”的api说明中,“This method will be called every frame.”是说“scheduleUpdate”这个方法本身也会在每帧被调用吗?
  3. “Only one “update” method could be scheduled per node.”,这句话什么意思不太懂,什么叫只有一个update方法会被scheduled,Node的update方法不只有一个吗?

谢谢。

那也就是可以理解是,如果不调用“scheduleUpdate”之前,“update”不会在每帧被调用了。
而且,“scheduleUpdate”不是每帧都会被调用了。

api的文档写的真难懂啊w

你可以看看代码里,答题用法是你调用scheduleUpdate之后,要再写一个update(dt)函数,这个函数是每帧都会调用的。并不是每帧调scheduleUpdate,而是调update。建议看cpp-test,文档代码一起看

1赞