Jump to content

Pixi 7 Loader baseURL equivalent in Assets init


jasonsturges
 Share

Recommended Posts

In previous versions of Pixi, I could set the base URL of a loader such as:

import { Loader } from "pixi.js";

const loader = new Loader();
loader.baseUrl = this.context.baseUrl ?? "/";

 

Does this translate to the following in Pixi 7?

import { Assets } from "pixi.js";

Assets.init({
  basePath: "https://domain/path/to/base",
});

 

This is not working for me, resolving to a relative url - seemingly not applied.

I've tried at the start of the Pixi App declaration, and inline before Sprite.from calls.

My solution loads a large number of assets throughout the lifetime of the app, and having the ability to specify this base url was convenient.  I must be missing something as to how this works now.

Edited by jasonsturges
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...