How get text size in textblock?

image

Hope it will help - TextBlock | Babylon.js Documentation

nop :c

cc @carolhmj

You can use measureText()-function of your AdvancedDynamicTexture’s context:

var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("UI");
console.log(advancedTexture.getContext().measureText("Hello World").width)

Example PG:

Docs:

3 Likes