AdvancedDynamicTexture.CreateForMesh Sometimes it doesn't work

Hello everyone, I have a problem that I can’t always find a solution to, I use the codes as I will give in the link below, but sometimes the texts overlap in a very ridiculous way, like in the example image, how can I solve this problem? is there an error in my code or is my code missing?
note i am using version 5.10.

image

LINK UPDATE => https://playground.babylonjs.com/#TMHF80#1707

I guess the overlap is because you have multiple textblocks, but you didn’t set top for them
Size Plane Based on Dynamic Texture | Babylon.js Playground (babylonjs.com)

By the way, I started having this problem after I upgraded from 5.0.3 beta to 5.10.0, is there a change in the GUI library between these versions?

Hum. Not sure about that. According to the doc, the ADT needs a resolution. When I read ‘resolution’ I understand expressed in pixels and this is the only way I have ever used it. Pinging @carolhmj

Yep it’s in pixels. I’m not really sure what’s the problem in the linked playgrounds as it looks like normal text to me? I see that the texture scale and angles were changed too so I’d probably change it back to see the default state.

The strange thing is that if I say I write 100 times, only 4-5 of them have problems and it drives me crazy, if you say that this is not a problem, I will understand you :slight_smile:

When you say “write” 100 times, do you mean running the playground 100 times? This exact same playground? It’s hard to say if it’s a problem or not if I can’t see it :slight_smile:

No no it’s a mistake due to my misrepresentation
I wanted to specify the rate of getting this error in my own react project.
That’s why I was hovering over the version anyway, as a last resort, I’m going to install the latest version.

Hmm if you can’t reproduce this error on the playground then we would need to see your react project, and there’s a lot that can be causing this on the react side too

I can send you a little demo for the codes

window.standLoader = SceneLoader.ImportMesh("", "/assets/", gltfName, scene, (meshes) => {
			meshes[0].name = "mymesh";
			meshes[0].scaling.x = 100.0;
			meshes[0].scaling.y = 100.0;
			meshes[0].scaling.z = -100.0;
			for (var i = 0; i < meshes.length; i++) {
				if (meshes[i].name.indexOf("text") > -1) {
					if (window.content[meshes[i].name]) {
						textReplace(scene, meshes[i].name, window.content[meshes[i].name], window.content[meshes[i].name + "_options"], meshes[i]);
					}
				}
			}
		});

I also shared the codes written in the textReplace function above in the playground.

Yeah there’s a lot that can go wrong there, like this window.content object since it’s a global window object it can not get cleaned between refreshes and mess up the logic

1 Like

Do you think I should send it as a pointer inside the function?