spine icon indicating copy to clipboard operation
spine copied to clipboard

PIXI v7 Uncaught TypeError: Cannot read properties of null (reading 'baseTexture')

Open tonywei92 opened this issue 1 year ago • 1 comments

I'm not sure what's happening with pixi spine does not work with some spine json file, but work perfectly with spine web player

package.json:

{
  "name": "pixi-7-spine-4_1_bug",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "preview": "vite preview"
  },
  "devDependencies": {
    "typescript": "^4.9.3",
    "vite": "^4.1.0"
  },
  "dependencies": {
    "pixi-spine": "^4.0.3",
    "pixi.js": "^7.1.2"
  }
}

the code:

    const container = new PIXI.Container();
    container.position.set(500, 500);

    const rocketSpine = new Spine(rocketSpineAsset.spineData);
    rocketSpine.state.setAnimation(0, "rocket_animation", true);
    rocketSpine.scale.set(0.32);
    const spaceshipSpine = new Spine(spaceshipSpineAsset.spineData);
    spaceshipSpine.state.setAnimation(0, "spaceship_flying_bunny", true);
    spaceshipSpine.scale.set(0.32);

    // work
    container.addChild(rocketSpine).position.set(5, -140);

    // does not work
    container.addChild(spaceshipSpine).position.set(5, -140);
the error is:
    Uncaught TypeError: Cannot read properties of null (reading 'baseTexture')
    at set texture [as texture] (MeshMaterial.ts:106:41)
    at set texture [as texture] (Mesh.ts:253:50)
    at Spine4.setMeshRegion (SpineBase.ts:517:14)
    at Spine4.update (SpineBase.ts:390:30)
    at Spine4.autoUpdateTransform (SpineBase.ts:535:18)
    at _Container.updateTransform (Container.ts:448:23)
    at _Container.updateTransform (Container.ts:448:23)
    at ObjectRendererSystem.render (ObjectRendererSystem.ts:91:27)
    at _Renderer.render (Renderer.ts:435:29)
    at _Application.render (Application.ts:136:23)

image

Code to test: https://github.com/tonywei92/pixi-7-spine-4_1_bug

could anyone please help me with this issue?

tonywei92 avatar Apr 02 '23 06:04 tonywei92

We're encountering the same issue when using looping png sequences with a Mesh and vertecies. Has anyone found a solution for this?

alexmaslarski avatar Nov 05 '23 15:11 alexmaslarski