求教~关于Scheduler的问题

我在使用引擎过程中,看到log会偶尔打出
“ warning: you CANNOT change update priority in scheduled function”
这样的警告。。

请问是什么操作会导致这种情况出现呢?使用的版本是cocos2d-js-v3.0-rc0

看了下代码:

void Scheduler::schedulePerFrame(const ccSchedulerFunc& callback, void *target, int priority, bool paused)
{
tHashUpdateEntry *hashElement = nullptr;
HASH_FIND_PTR(_hashForUpdates, &target, hashElement);
if (hashElement)
{
// check if priority has changed
if ((*hashElement->list)->priority != priority)
{
if (_updateHashLocked)
{
CCLOG(“warning: you CANNOT change update priority in scheduled function”);
hashElement->entry->markedForDeletion = false;
hashElement->entry->paused = paused;
return;
}
else
{
// will be added again outside if (hashElement).
unscheduleUpdate(target);
}
}
else
{
hashElement->entry->markedForDeletion = false;
hashElement->entry->paused = paused;
return;
}
}

// most of the updates are going to be 0, that's way there
// is an special list for updates with priority 0
if (priority == 0)
{
    appendIn(&_updates0List, callback, target, paused);
}
else if (priority < 0)
{
    priorityIn(&_updatesNegList, callback, target, priority, paused);
}
else
{
    // priority > 0
    priorityIn(&_updatesPosList, callback, target, priority, paused);
}

}

貌似我没有修改过scheduler的优先级,为什么会报出这个警告呢?

没人遇到么??自己顶。。。

等。。接着等

:6::6::6::6:

:3::3::3::3:

帮楼主顶,同样的问题,cocos2d-x v3.2版本。使用armature动画的时候出现得相当频繁。

“ warning: you CANNOT change update priority in scheduled function”
意思大概是 在 scheduled 回调函数里面你不能改变 priority 优先级

终于有帮顶的了:2:

:12::3:

顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶

有人顶可是木有人回答- -悲剧。。

顶啊!!!我也遇到了,使用的3.2,感觉完全没有改变过什么优先级啊

同求。。。。。。。。。。。。。。。。。。。

这应该是在实现动画的源代码里有改变优先级的操作,记得之前也遇到过,3.2版本还没用过

估计是多次调用scheduleUpdate 引起的

如果你有呼叫node的scheduleUpdate(), 則需要在適當的時候,例如destructor 呼叫 unscheduleUpdate(),
刪除一個node並不會自動移除你呼叫shceduleUpdate()時加入的hash

這個訊息會在以下的情況出現:
你new了一個node, 此node被系統分配在A位址,此node有呼叫scheduleUpdate()
這個node被釋放了, 有另一個有呼叫shceduleUpdate()的node被分配在A位址, 此時因為hash中已經有上個entry就會出現此訊息

但是此時的情況並非warning訊息字面上的情況.

(通常的node不會自動呼叫, 可以直接搜尋, 只有幾個物件默認有呼叫, 而且也沒有呼叫相對應的unscheduUpdate)

— Begin quote from ____

引用楼主aiyaaiyaaiyaai于2014-09-09 19:14发表的 求教~关于Scheduler的问题 :
我在使用引擎过程中,看到log会偶尔打出
“ warning: you CANNOT change update priority in scheduled function”
这样的警告。。

http://www.cocoachina.com/bbs/job.php?action=topost&tid=227916&pid=tpc

— End quote

楼主你的问题我也遇到了,我一点一点的追踪代码,发现我是在 Scheduler (我的schedule 函数是这样的 在这个函数里面调用了下面两行代码 this->schedule(schedule_selector(FishLayer::addFish), 1);)的回调函数里
调用了下面两行代码
//this->unscheduleUpdate(); //this->scheduleUpdate();

把上面那两行代码注释掉,那个警告就会消失

楼主分析的很到位,我遇到了,问题就和你描述的一样

顶你个肺。。。。

有人吗?顶顶顶:2::2::2::2: