Sprites leave traces in game, but not on RenderTexture

Hello,

I am a total noob trying to learn Unity by designing a simple game, but I keep running into some issues at a very basic level. I am a software engineer, so I consider myself quite technically capable, and it feels like there is just some core concept that I can not seem to wrap my head around, that, once it clicks, should make it very easy to understand what I am doing wrong.

So here’s what I want: A game where you just click sprites that randomly appear on the screen, and disappear after some time. There’s some textual information overlaying the screen that is constantly updating. Because I want a pixelated look of my sprites, I create a low-res RenderTexture and set that as output of my camera, and then I created a RawImage that takes the RenderTexture, and attach it to the canvas. I have some scripts that manage the game behavior.

The basic behavior works, I see the sprites appearing and the text updating, but there’s a few problems:

  1. I have a black background, but the background of my camera is set to Skybox.
  2. The sprites that have faded away leave a blue-ish trace on the screen
  3. The text also leaves a trace; when the text ‘20’ is replaced by ‘19’, both texts appear overlapping on the screen.

Here’s a screenshot of the problem:

I hope someone can alleviate me, and explain me what I am doing wrong/what concept I have upside down. Thanks in advance!

Stijn

Generally anytime something is left behind like that, your camera is not set to clear properly before rendering. That’s the first place I would look.