Jump to content

Destroy all children but keep base textures in tact


voidstar
 Share

Recommended Posts

My game has multiple game states (ie levels) and each game state has a root container to which all further pixi objects are children off.  When swapping game states I wish to clean up all the objects that were part of that state but leave the base textures in tact for future use.  If I call destroy(true) on the root container so that it destroys itself and all it's children then it also destroys all the base textures used by those children which means I'd have to reload all my assets when swapping states.  Is there a way I can destroy everything attached to the root container but leave the base textures untouched?

Link to comment
Share on other sites

Ok I got the update to work but I have two issues.  Firstly I don't seem to be able to set the default texture scale mode anymore, it's now a read only property.  What's the correct way to do this in v4?  Secondly, upgrading my typescript version has broken intellisense in Visual Studio 2015 which now refuses to understand any PIXI code regardless of the fact I've updated the proj files, rebuilt the code, and cleared the cache.  Has anyone encountered this before?

Link to comment
Share on other sites

Going back to PIXI v3 fixed the issues with intellisense.  I'm guessing PIXI v4 isn't yet compatible with typescript 2.2 and in typical Microsoft fashion if I try to download installers for typescript 2.0 or 2.1 from their website they keep giving me version 2.2 instead.  Guess I'm stuck with v3 for now

Link to comment
Share on other sites

Sorry for all the updates but I just keep running into problems.  I gave upgrading another crack by uninstalling typescript completely and installing version 2.2 (the only version I can get my hands on).  This seems to have fixed the intellisense issues with PIXI v4.  However I'm still getting an error when trying to set the scale mode.  This code:

PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;

results in the error:

Quote

Cannot assign to 'SCALE_MODE' because it is a constant or a read-only property.

Does anyone know why this is and how I get around it?

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...