Creating a new BitmapText object fails after calling destroy on a previous one when using a font that is split up into multiple pages.
See original GitHub issueExpected Behavior
To create BitmapText
objects without any errors.
Current Behavior
Creating a new BitmapText
after destroying a previous one results in a Cannot read properties of null (reading 'alphaMode')
error.
Steps to Reproduce
Like I did here.
Create a BitmapText
object with an initial value of characters that are from 2 different pages and add it to the stage.
Wait for at least one frame and change the text to a character that is in only one of the pages.
Wait for another frame and destroy the BitmapText
object.
After that, try creating a new BitmapText
with any of the previous characters used and observe the error.
Environment
pixi.js
version: 6.5.5- Browser & Version: Chrome 105, Firefox 105, Brave 1.144
- OS & Version: Windows 10
- Running Example: example
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Creating a new BitmapText object fails after calling destroy on ...
Creating a new BitmapText object fails after calling destroy on a previous one when using a font that is split up into multiple...
Read more >Phaser 3 API Documentation - Class: BitmapText
Controls the alignment of each line of text in this BitmapText object. Only has any effect when this BitmapText contains multiple lines of...
Read more >new PIXI.BitmapText (text, style) - PixiJS
A BitmapText object will create a line or multiple lines of text using bitmap font. The primary advantage of this class over Text...
Read more >Phaser.BitmapText - 2.6.2 - Learn
BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure. It then generates a...
Read more >PIXI.BitmapText
A BitmapText object will create a line or multiple lines of text using bitmap ... case the font is in a file called...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @SuperSodaSea I have opened https://github.com/pixijs/pixijs/issues/8732, feel free to update it as needed. I provided links for reproducing in v6.5.6 and showing that it does not reproduce in v6.5.2 but it sounds like you already have a clear idea of the cause.
Assigning to
Texture.EMPTY
to used pool textures on destroy fixed this.