Access the scene from anywhere
I have a cocos2d hierarchy of layers that is very very deep. I want to access my scene from any of the layers? Ho开发者_如何学Pythonw would I do this?
If I use a singleton will the retain on the singleton prevent the layer from being garbage collected when scenes are changed using the director?
i guess one approch is to use [CCDirector sharedDirector].runningScene sould do the trick if you want to get access to the current running scene, but about decleraing your scene as a singleton yes it prevents garbage collector if you retain your scene whenever iit's created but you have to remeber to release it whenever you are done with your scene.
精彩评论