perform selector is not called the second time scene is loaded
I am calling a method in my init method of the scene with perform selector. When i replace the scene replace scene method of CCDirector and move to the other scene and then i replace the other scene with the previous scene it comes into its init method but doesn't call the method that i want to call with the perform selector after delay.
If there is some guys who have faced such type of problem then please share your ideas or if anybody have solution开发者_开发知识库 then please reply.
Thanks
Some of your code would have been welcome to start. ;)
First of all you should use Cocos2d scheduler instead of "performSelector:withObject: afterDelay:" methods. "PerformSelector:withObject:afterDelay:" is a NSTimer based, and so it's not recommended into the best practices. Please refer to the doc here: Best practices.
Try to perform your method into the "onEnterTransitionDidFinish" instead of the init method. Like that, you are sure that the object is appeared before the call.
精彩评论