#Updated TMP text is displayed on top of previous value

1 messages · Page 1 of 1 (latest)

civic blade
#

Hello, I'm using a TMP text in a 2D game and I have a problem where each time I update the text value, the new value is displayed on top of the previous one, for example, Turn 2 is drawn on top of Turn 1, making the 2 and 1 mixed up, and it does that until the number is a mix of 1 to 9 and become kind of a white square. I check in the hierarchy at runtime there doesn't seem to be more than 1 instance of the TMP object (it's not even instantiated by code to begin with). I tried a lot of things like clearing the text before updating it, calling a refresh after updating but nothing works. Any idea?

cunning sky
#

Sounds like the frame data isn't being cleared? Though that's not really some exposed parameter with canvas overlays if you're using one

civic blade
#

I'm sorry I'm a beginner with Unity, only done the 2 Roguelike tutorial and started working on a similar personal project. Here are some of my settings, please ask me if you need me to show any other elements 🙂

cunning sky
#

Not really seeing anything about refreshing the canvas in the API

#

You are setting a solid background type with 0 alpha, but I don't really think that implies anything as a main camera.

civic blade
#

Oh I found the problem I think! It was because of this setting:

cunning sky
#

My suggestion is work up from the bottom. Make a new scene with a skybox and see if you can get a canvas going and without issue. Then try changing few things at a time like the skybox

civic blade
#

I use it to have some black borders around the map to put my texts:

#

If I reset it to default values, the text is correctly updated:

#

But then I lose my UI space

cunning sky
#

That's actually more confusing to me. Perhaps the canvas isn't in charge of refreshing its frame data, and the full rasterization of that frame data is up to the main camera?

#

Because this would imply that the text outside of the camera rect is uninitialized (sure), but the canvas not clearing on the next frame doesn't really make too much sense to me

civic blade
#

I think it's not clearing the previous framers out of it's viewport or something?

cunning sky
#

That's what it seems.

civic blade
#

I need to find a better way to put my UI in the game I think

cunning sky
#

I mean it makes sense I guess. The camera probably checks the space it occupies and clears it each frame, but the canvas shouldn't care and leaves it up to the camera

civic blade
#

Mhhh maybe there's an option for that somewhere, now that you helped me pinpoint the problem I'll try to find something

cunning sky
#

Yeah, I usually just make a camera regardless for the UI space so I've not really ran into this problem

#

even in a scene with only UI I'll throw on a camera with a solid background as you'd get the annoying warning of no cameras in the scene