You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in cocos3.2 there are many scheduleUpdate() call without corresponding unscheduleUpdate() ,
if you don't call unscheduleUpdate(), the _hashForUpdate in Scheduler will keep the hash pair forever.
i don't know in normal situation this will make problem or not. but in my situation this make problem.
i notice this because i always got :
"warning: you CANNOT change update priority in scheduled function"
in console output. if you got this warning then function goes "return;"
this mean the target you call scheduleUpdate() is fail to add update() to _updates0List.
and this also mean your target will never call its update();
。in normal situation, u don't get the warning msg. just leave the key in hash. once you new a node , if system give you the address same with key. and u call scheduleUpdate with this node. In function schedulePerFrame statement goes:
// will be added again outside if (hashElement).
unscheduleUpdate(target);
this mean it clear the leak key and says it will added what you want after. its true. but still a very little probability, the dirty priority == priority make statement:
if ((*hashElement->list)->priority != priority)
become false. then unscheduleUpdate() not call and return. the schedule still fail.
。in my situation, i use a schedule function to create a node with scheduleUpdate in initialize().
because the create is in a schedule function, this function will call in scheduler::update(),
this make expression:
if (_updateHashLocked)
become true and get the warning message. and make schedule fail. additionally the warning message is not match with situation we meet. we had not change the priority.
situation2 is easy to happen.
for example
if you use action "CallFunc" to create a Fx obj. and the Fx need scheduleUpdate to do something.
or
if you use spine as your animation system. spine use update function to trigger event system.
you spawn Fx obj in event, again, the Fx need update() to do something.
the key is
you had create a nodeA at addressA which will call scheduleUpdate().
the nodeA is destroy, and because of not calling unscheduleUpdate(), it leave addressA in hash
you have a functionB will call by schedule::update and functionB will create nodeB, and system give you nodeB at addressA, and nodeB call scheduleUpdate();
i think pair unscheduleUpdate with scheduleUpdate() fix some problem. but there is a more complex
way to goes the warning message. i will describe in another issue.
The text was updated successfully, but these errors were encountered:
in cocos3.2 there are many scheduleUpdate() call without corresponding unscheduleUpdate() ,
if you don't call unscheduleUpdate(), the _hashForUpdate in Scheduler will keep the hash pair forever.
i don't know in normal situation this will make problem or not. but in my situation this make problem.
i notice this because i always got :
in console output. if you got this warning then function goes "return;"
this mean the target you call scheduleUpdate() is fail to add update() to _updates0List.
and this also mean your target will never call its update();
。in normal situation, u don't get the warning msg. just leave the key in hash. once you new a node , if system give you the address same with key. and u call scheduleUpdate with this node. In function schedulePerFrame statement goes:
this mean it clear the leak key and says it will added what you want after. its true. but still a very little probability, the dirty priority == priority make statement:
become false. then unscheduleUpdate() not call and return. the schedule still fail.
。in my situation, i use a schedule function to create a node with scheduleUpdate in initialize().
because the create is in a schedule function, this function will call in scheduler::update(),
this make expression:
become true and get the warning message. and make schedule fail. additionally the warning message is not match with situation we meet. we had not change the priority.
situation2 is easy to happen.
for example
if you use action "CallFunc" to create a Fx obj. and the Fx need scheduleUpdate to do something.
or
if you use spine as your animation system. spine use update function to trigger event system.
you spawn Fx obj in event, again, the Fx need update() to do something.
the key is
i think pair unscheduleUpdate with scheduleUpdate() fix some problem. but there is a more complex
way to goes the warning message. i will describe in another issue.
The text was updated successfully, but these errors were encountered: