- Home /
2D URP doesn't clear screen after moving object
I changed te renderer in urp to a 2D one in order to use the 2D lights and made a script to move a sprite with the mouse but when it moves the previous frame isnt't deleted so the game just draws over the previous frame. When i change back to the normal urp rendered the problem dissaprears.
This is the code i use to move the sprite it is atached to the sprite
bool clicked = false; // Start is called before the first frame update void Start() {
}
// Update is called once per frame
void Update()
{
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
if (clicked)
this.gameObject.transform.position = new Vector3(mousePos.x, mousePos.y, 1);
}
void OnMouseDown()
{
clicked = true;
print(this.gameObject.name);
}
void OnMouseUp()
{
clicked = false;
}
Here is an example of the effect in which the screen doesn't clear the previous frame [1]: /storage/temp/184783-screenshot-2021-08-13-194500.png
![alt text][1]
Your answer
Follow this Question
Related Questions
My camera not rendering anything in Custom render type,I have an issue: 0 Answers
How to Display Hundreds of Thousands of Sprites? 2 Answers
Upgraded to URP and now my animations are not working correctly. 1 Answer
Render 2 sprites using one GameObject Unity2D 2 Answers
Sorting Axis on LWRP? 1 Answer