Bug: Dimensions of color surface does not match dimensions of depth surface

I just upgraded from 2019.3.0.f1 to 2019.3.5.f1 and am now getting this error every frame:

Dimensions of color surface does not match dimensions of depth surface
UnityEngine.Rendering.RenderPipelineManager: DoRenderLoop_Internal(RenderPipelineAsset, IntPtr, AtomicSafetyHandle)

which points to line 233 in UniversalRenderPipeline.cs

That certainly looks like a serious bug.

Can you file a bug report so we can take a look at it ASAP?
Please send me the ID as well.


Thanks, Case 1229081

1 Like

It seems to have randomly stopped now with the latest restart of Unity. The first 3 restarts didnt help so not rly sure why.

This bug still exists. I'm getting it in builds of a commercial product.

1 Like

@stonstad do you have any repro steps or it also happened for you after upgrading the project?

Hi @erikabar . I don't have repeatable insight into what steps cause it. What I can say is that it came from a built player that I had shipped to a customer and the player.log file filled to the max with "Dimensions of color surface does not match dimensions of depth surface" statements. I do not use the URP -- this is standard pipeline. T

Not sure if this helps -- the application uses the -parentHWND startup switch. The parent window is deactivated and activated on-demand. I believe this was with 2019.3.7f or 2019.3.9f1. The log file has been replaced with a new one that is not exhibiting this behavior.

If I discover more I will share it here.

1 Like

Hi erikabar, I'm experiencing the same problem with Unity 2019.3.12. For some reason, this bug only pop up when I changed the size of my screen editor. It goes away when when I resized my screen editor.

Dimensions of color surface does not match dimensions of depth surface
UnityEngine.GUIUtility.ProcessEvent(Int32, IntPtr)

Was there any lick finding a solution for this, I'm following the Custom RP tutorial from Catlike Coding

I don't know if this is any help but I had this issue pop up when I added the line:

dirShadowAtlasId, atlasSize, atlasSize,
32, FilterMode.Bilinear, RenderTextureFormat.Shadowmap

if I comment the line out the error ceases to increase in count.


EDIT: Update - got a response from the Bug Report I submitted saying that it was fixed in URP version 8.0.1. My Package Manager shows 7.4.1 as the most current version, so thats what I had been using :roll_eyes:

@erikabar @Elvar_Orn

I'm also having this error - here is a thread I created with a barebones repro and a link to a bug report ticket: https://discussions.unity.com/t/803174

My case may be a separate issue more specific to the 2D Renderer - it only happens with a Point Light 2D with "Use Normal Map" selected.

Thanks for any help!

Same here, and it only happens to the scene view if you turn on the light button

1 Like

Also having this problem, did you manage to find a solution?

Yes, IIRC, just ignore that error and it will disappear after that chapter

1 Like

i have the solution, i dont suppose you have resized your windows view so you can see more of the image, reset your screen size in windows as its confusing the game as the game is pushing more texures than the screen is projecting

I updated to Unity 2021.1.0a7 (following the most recent comment I saw here) and can confirm this is still an issue.

I am working on a custom RP. I am working through this tutorial. Section 1.5 Creating a Shadow Atlas exposes the issue.

As mentioned above, it is this line that causes the issue (reformatted so it's easier to read):


This issue causes neither the Scene nor Game views to render anything. Disabling lighting in the Scene view allows that view to display, but only because the above line does not actually execute anything, since the Scene view does not rendering lighting. The Game view still does not display anything; it is just a black window (though errors are not logged to the console).

Commenting out the above line results in both the Scene and Game views properly displaying an image.

This bug does not appear to be fixed, or confined to the URP.

It appears changing the code as listed in section 1.6 Shadows First of the tutorial stops the errors from displaying in the console and allows the Scene and Game views to successfully render.

Why is this? Is this expected behavior?

Going through the tutorial, it looks to be like the code is section 1.5 is expected to run without error. Though the author does say that the code in section 1.5 "is not what we want". This error also seems to be a genuine bug in other, similar, use cases. I'm confused.

@bsgbryan It's setting the render target that messes things up, not just the step of getting a render texture. It goes wrong in section 1.5 because the shadow map render target replaces the camera's render target. Regular geometry gets rendered to the shadow map instead of the frame buffer. This is what we don't want. In section 1.6 we fix this by setting the shadow render target first, so the regular render target is set afterwards, followed by regular rendering to the correct target.

Target shadow atlas > render shadows > target frame buffer > render camera.

This is specific to the tutorial, not any bugs URP might have.

1 Like

I am experencing this error in another way: By setting the color Rendertarget to the CameraTarget and the depth Rendertarget to one of my Rendertexture (name it "DepthTex").The code just like


What i am going to do is to render some objects first and directly render the depth info to DepthTex , then use SetRenderTarget to set it back to what it was. Then the error we are talking about just pop up. I thought i havn't reset the depth Rendertarget properly , so I try


But this gives a warning :
"CommandBuffer: built-in render texture type 3 not found while executing SceneCamera (SetRenderTarget depth buffer)"
I have set the " camera.depthTextureMode = DepthTextureMode.Depth;" before rendering, but the warning is like saying that such thing doesn't exist. And the error is still going on.
Then i try another way, without specific depth Rendertarget param :


this didnt stop the error, too.

Then i think maybe is the format of the DepthTex causing the problem, but .Depth and .ARGB32 is both not working.

So is this really an error, or a bug? Since i notice someone above mentioned URP version, and my version is 7.1.8, and i can't find further version in my package manager, do i need to upgrade my unity first(2019.3.0f3)?

If this is an error, what's the wrong i have made?

By the way, your tutorial is of great great help to me!Thanks for sharing it !

1 Like

URP 8.2.0
Now I have this error
Any idea how to solve it?

Same issue but with Parametric Light 2D. Unity 2020.2.1f1.

URP 10.2.2

That certainly looks like a serious bug!