Jump to content

Multiple atlasses with same frame names conflict


spassvogel
 Share

Recommended Posts

So in my game I have multiple sprite sheet atlasses representing the animated characters. Those characters all have animation frames, eg: "walk1", "walk2", "idle1" etc. I load them via the shared loader. I want to be able to load any of those character spritesheets into an AnimatedSprite and tell them to play the frames "walk1", "walk2".  However it seems pixi overrides the textures

Texture added to the cache with an id [walk1] that already had an entry

 

And all my characters are using the frames from the latest loaded spritesheet ? Is there some way around this?

Link to comment
Share on other sites

Well no I'm actually very happy with the global pixi loaders' cache. In my setup (using @react-pixi) pixi is set up and torn down multiple times (because components get unmounted etc). So it's very nice that the sprites are kept in cache. Perhaps I am alone in this but I think sprites loaded through a spritesheet atlas should get some sort of encapsulation, maybe just by prefixing with the atlas name or something.

Link to comment
Share on other sites

Good idea, maybe it was written somewhere, but i cant find it :(

How to do a PR: https://github.com/pixijs/pixi.js/tree/dev/packages/spritesheet/src , change spritesheetLoader that way it passes extra param from "resource.metadata" to spritesheet constructor or extra param before parse(). Change spritesheet, add prefix param and use it in addToCache

 

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