Sign in to follow this  
ewinter

Undestroyable textures

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.