EsotericSoftware / spine-runtimes

2D skeletal animation runtimes for Spine.
http://esotericsoftware.com/
Other
4.42k stars 2.92k forks source link

[spine-pixi] [Assets] atlas could not be loaded as we don't know how to parse it, ensure the correct parser has been added #2655

Closed yxdtg closed 1 month ago

yxdtg commented 1 month ago

[Assets] http://localhost:xxx/xxx.atlas could not be loaded as we don't know how to parse it, ensure the correct parser has been added

"@esotericsoftware/spine-pixi": "^4.2.61", "pixi.js": "^7.4.2"

` Assets.add("skel", skelUrl);

Assets.add("atlas", atlasUrl);

await Assets.load(["skel", "atlas"]); `

davidetan commented 1 month ago

I'm afraid your code is not enough to reproduce the problem. Can you show us more information or share a minimal reproduction example of your issue?

yxdtg commented 1 month ago

This warning occurs if the file is not parsed after loading

const skeUrl = "./mengmei/mengmei.json";
const atlasUrl = "./mengmei/mengmei.atlas";

Assets.add("ske", skeUrl);
Assets.add("atlas", atlasUrl);
await Assets.load(["ske", "atlas"]);

If the file is parsed after it is loaded, no warning is displayed

const skeUrl = "./mengmei/mengmei.json";
const atlasUrl = "./mengmei/mengmei.atlas";

Assets.add("ske", skeUrl);
Assets.add("atlas", atlasUrl);
await Assets.load(["ske", "atlas"]);

const spine = Spine.from("ske", "atlas");

I plan to load all files first and then parse the skeletonData when needed later on. However, if the files are loaded but not parsed immediately, a warning will appear, resulting in the atlas data being null.

davidetan commented 1 month ago

I still cannot reproduce the issue.

Can you reproduce it in the basic example of spine-pixi?

My guess is that in the first example you are not importing spine-pixi. You have to import it to add the atlas parser to Pixi, even if you are not instantating a Spine game object.

yxdtg commented 1 month ago

As you said, the problem has been solved. Thank you