Sunday, December 21, 2025
spot_img

[Cocos Creator 3.8.8] Appropriate method to destroy/cleanup an embedded recreation in an SPA to keep away from getGFXTexture errors – Cocos Creator


I’m working into a difficult difficulty with Cocos Creator 3.8.8 and will use some recommendation from anybody who’s achieved one thing related.

I’ve a recreation constructed with Cocos Creator, and it’s embedded as only one half of a bigger Single Web page Utility (SPA). Consider it like a recreation widget on a particular web page. When a person navigates away from that web page, I have to fully tear down the Cocos occasion to release reminiscence—no leaks, no leftover sources.

I’ve constructed a cleanup methodology that does what appears logical: pausing the sport and director, stopping sounds, destroying the scene, clearing caches, releasing the WebGL context, and many others. The sport does cease.

However right here’s the issue: proper after calling my destroy() methodology, the browser console will get spammed with this error:

cc.js:1 Uncaught TypeError: Can't learn properties of null (studying 'getGFXTexture')

It seems just like the engine’s inner loop continues to be attempting to run and render after I’ve already cleaned up the textures and sources.

My core query is: In Cocos Creator 3.8.x, what’s the appropriate order or API calls to completely shut down the engine on the net? How do I guarantee the interior render/replace loops are fully halted earlier than I begin destroying graphics sources?

Has anybody efficiently embedded after which cleanly destroyed a Cocos recreation inside an SPA? Any tips about what I may be lacking within the teardown sequence can be a lifesaver.

Thanks upfront!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles