Jump to content

@pixi/assets v6 default scale mode not propagating to loaded textures


Recommended Posts

HI, I'm loading assets with the new @pixi/assets wrapper and setting default scaleMode before loading doesn't work - baseTextures still have scaleMode set to 1(linear).
I manually set loaded texture data like so

const defaultScaleMode = { scaleMode: PIXI.SCALE_MODES.NEAREST };
const addAssetWithDefaults = (alias, source) => Assets.add(alias, source, defaultScaleMode);

addAssetWithDefaults('player', 'public/images/player_16.png');

Unfortunately that didn't propagate to json Spritesheets's related textures.

addAssetWithDefaults('player_idle', 'public/images/player/player_idle_new.json');

Is there a current documentation on how to properly set that up? In fact loading spritesheets from json doesn't quite work, I had to change line:60 in spritesheet.js to

this.baseTexture = texture instanceof core.BaseTexture || !this._texture ? texture : this._texture.baseTexture;

just so that the Spritesheet can have it's corresponding baseTexture. 

I literally read all related errors that were posted, but didn't do that trick for handling loading errors I was getting.
Happy to provide more info/examples.

Screenshot 2022-09-21 at 12.26.10.png

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.

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.


  • Recently Browsing   0 members

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