When I first touched Cocos, thank you for this LUA code:
<span style= "FONT-SIZE:18PX;" > cc. Director:getinstance (): Getscheduler (): Schedulescriptfunc (Createonepairpipe,2.5,false) </span>
Then I used the following code at the end of the game:
<span style= "FONT-SIZE:18PX;" > Local startscene = require ("Scenes/startscene") cc. Director:getinstance (): Replacescene (Startscene:create ()) </span>
The following error is then reported:
Invalid ' CObj ' in function ' Lua_cocos2dx_node_addchild ' ERROR when addChild
This addchild is I unload createonepairpipe function inside, this error reason is I replacescene when the current scene will be destroyed, natural self is gone, However, the new thread generated by Schedulescriptfunc (which we would call a thread) is still executing, so we need to turn this thread off before switching the scene, as follows:
<span style= "FONT-SIZE:18PX;" >local Schedulerid = cc. Director:getinstance (): Getscheduler (): Schedulescriptfunc (Schdulet, 1, false) cc. Director:getinstance (): Getscheduler (): Unschedulescriptentry (Schedulerid) </span>
[Cocos2d-x Development Issue-6] Timer problem