Wrong Text showing in TextMeshPro

I have a prefab that has a TextMeshPro that I spawn a lot of, edit the text, and destroy, sometimes several a second. There is a bug every few prefabs where the text rendered is wrong; It is showing the text of a past prefab. I added logs to check the text I am inputting, and the text of the component after I set it, and they are correct. But in game, they are showing a previous playfab’s text both in game and inspector.

Edit: It seems to always show what the previous text was supposed to be.

Can you share some code?

Spawn Code:


Setting Text:

Well, in your spawn code, you should call your Set(int exp) function on deth_anim, not on deathAnimation.

Now you are spawning a prefab, then changing prefab’s contents. That will not affect object you just spawned, it will affect the object you will spawn next.

1 Like

That must be it, thank you!