Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tonywei92 opened this issue Apr 2, 2023 · 1 comment

Comments

@tonywei92
Copy link

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?

@alexmaslarski
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants