Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.29k stars 344 forks source link

Unity using DOTween pro UI creates ghost effect #687

Closed darkalardev closed 2 weeks ago

darkalardev commented 3 weeks ago

Hello! I'm working on UI animations using DOTween Pro but the animations creating ghost effects. I testing with this scripts:

protected virtual void OnEnable() { transform.DOPunchScale(new Vector2(1.3f, 1.3f), 0.2f); }

I thought it was an error in my script but when I removed it and used the DoTween tool the same thing happened:

Captura de pantalla 2024-06-13 221427

Error that happens:

https://github.com/Demigiant/dotween/assets/62443810/c6b846b0-4ab5-48c0-a672-920fa9ab756f

Try to use the above but in another panel and the texts look bad when animated:

Before: image

After: image

I thought it might be a Render error, so I made the same animation using Animator and it looks correct.

Decavoid commented 3 weeks ago

Press pause in the middle of the animation. image

Attach expanded Hierarchy view screenshot of your UI layout to see if multiple copies of the UI window has been created. Attach screenshot of the Inspector view of the UI camera. Is there more than 1 camera in the scene? Do you have any postprocessing effects that affect the camera? Is Clear Flags property of the UI camera set to Solid Color or something else? Inspect the rendered frame using this Unity tool: Window - Analysis - Frame Debugger.

darkalardev commented 3 weeks ago

Hello!

I wouldn't be seeing the UI duplicated. Something curious happens, when you pause in the middle of the animation, you see the ghost effect but it disappears despite having the game paused.

image

I have different canvases since it is a modular system and for optimization I do not want to render the entire UI.

image

I thought it could be a problem with the canvas group but even if I delete it it still happens. These canvases are not tied to a camera, but those in the main menu where the same thing happens, if they are, specifically in Canvas > Render Mode > Screen Space Camera. I'm using Unity 2022.3.25f1 URP

Decavoid commented 3 weeks ago

Try to reproduce this in a new Unity project using Built-In Render Pipeline.

Decavoid commented 3 weeks ago

It looks like your current render pipeline is not properly configured to clear depth or frame buffer every frame.

darkalardev commented 2 weeks ago

I solve it! I made a new project in URP so that the Render is configured correctly, and there must always be a camera in the scene.