Text.addColor() Phaser 3 alternative (and some other questions)

Hey all,

I have finally decided to port the mathematical software I am developing from Phaser 2 CE to Phaser 3 - the one in the link is on Phaser 2 CE.

There is one method I am currently missing: Text.addColor - where I could add different colours to text from one index to another in Phaser 2. Basically this demo: https://phaser.io/examples/v2/text/colored-characters . I need this for my payouts, as seen here:
image

This is the same text, only that each new line has a different color. I am worried that if I create 4 texts, performance will suffer, as each node will have 4 additional GameObjects (it already has 3 or 4). Any ideas would be much appreaciated.

One additional question - has anyone noticed that the creation of MANY GameObjects (sprites/text/containers in my case) is significantly slower on Phaser 3? Each node in the software has ~4 sprites attached to it. When I create 30+ new nodes at once, there is a noticeable delay, after which the tweens run at 60fps. The more nodes I create, the bigger the delay. Generally, performance is MUCH better in P3 in comparison to P2, but this delay is strange.

If anyone is interested in the second question, I can deploy the P3 version for comparison.

Thank you for your time and help.

Hi Fractal_Games,

I have had a quick look around for the addColor and came across this issue on github

Rex has made an unofficial plugin which could be useful as an alternative.

Demo:
https://codepen.io/rexrainbow/pen/OZbOyg?editors=0010

Hope this helps a little :slight_smile:

Thanks! I will give it a try.

Due to my very specific case (4 lines with 4 fixed colours), I ended up using a linear gradient fill.

@retroVX I am sure that the plugin is great, but I am developing this in Angular + Typescript. Adding a plugin gives a ton of tslint errors and lack of auto-complete.

Still, I have a very big problem with performance when creating objects. I will try to investigate further.