开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜