I marked this as 2021-3-LTS but it also occurs on 2019 LTS.
If you make a new project, add a terrain, and then add a script to the camera with the function:
void OnPreRender()
{
gameObject.GetComponent<Camera>().depth = 5;
}
The editor will immediately crash on play. (The same code is fine if in Update)
I get that this isn’t exactly good form, but it gave a good bit of headache to debug this (this was part of a VFX pass where pre-render for the vfx camera would copy the main camera but re-set its depth to render after it, this code would sometimes get called in OnPreRender). Should probably just error out or something if changing the camera depth order during the renderpass is unallowed.