开发者

Access the scene from anywhere

开发者 https://www.devze.com 2023-03-05 18:02 出处:网络
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?

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

精彩评论

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