Jump to content

Undestroyable textures


canvasman
 Share

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?

Link to comment
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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...