Reputation: 1868
I am developing a Cocos3d based iOS project. I am running a scene once the app is launched and clicked on "Start scene" option. I have a Back button in the scene. Clicking on this Back, will take us to app home screen. Clicking on again "Start scene" option, currently it launches the previous scene itself. But, whenever Back button is clicked , i want to stop the running scene and unlock all the resource. And then again "Start scene" option, it should launch scene freshly.
Could someone advise, how to stop the running scene and unload all resources pod etc.?
Thank you!
Upvotes: 1
Views: 258
Reputation: 2374
You can try the following to stop displaying a Cocos2D CCScene
(including any 3D scenes being displayed), and releasing all cached objects:
CC3Texture.shouldCacheAssociatedCCTextures = NO; // Breaks links between Cocos3D textures and Cocos2D textures
[CCDirector.sharedDirector end]; // Removes active CCScene and clears Cocos2D caches
[CC3OpenGL.sharedGL clearOpenGLResourceCaches]; // Clears Cocos3D caches
If you are using a CC3ViewController
subclass, and you don't expect to need any OpenGL for a while, then you can also use the terminateOpenGL
method to perform all of the above, plus completely shutdown OpenGL. See the CC3DemoMultiScene
demo app for examples of doing this.
Upvotes: 1