canvasman Posted March 10, 2019 Share Posted March 10, 2019 If I have a lot of objects in my stage and I want to destroy whole stage with its children what would be good way to exclude some of textures or base textures from being destroyed? Should I remove them with removeChild before I will do stage.destroy(true) or could I NOOP destructive functions somehow in chosen textures? Looks like PIXI.Texture.WHITE has something like this going here https://github.com/pixijs/pixi.js/blob/dev/packages/core/src/textures/Texture.js#L567 Could that removeAllHandlers() functions be used in my situation? Also why is .on, .once and .emit NOOPed, isnt .destroy enough? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 10, 2019 Share Posted March 10, 2019 Yep, its a problem. I use custom destroy because of that, based on refCount and some other techniques, like counting added_to_Stage and removed_from_stage events that dont exist in pixi. We dont have general solution for it, however I can mention that "dispose()" is better than destroy() for textures, but you only find a few objects that support it, you have to build your recursive functions on top. Destroy is nooped too. https://github.com/pixijs/pixi.js/blob/dev/packages/core/src/textures/Texture.js#L569 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.