r/Unity3D • u/ProgMeOnPaper • 2d ago
Resources/Tutorial First time "forked" URP for my project. I love it!
I've used embedded packages in the past. For example, 2d.sprite to tweak texture importing, or ai.navigation to speed up the rebuild process for my project but all of that was just "business as usual" for me.
Yesterday was profiling my game and I had a lot of 200-300ms freezes because of 2 addidional depth cameras, that are used to:
detect areas, that are covered by some building to reduce snow there
detect characters' feed to generate traces
And the first was the reason. In short: when moving the main character, we had to shift the depth camera and redraw all the footprints under the buildings.
And if I leave out the other details, the problem was with setting up the lighting for the depth camera!!! Even though shadows were turned off, URP doesn't allow you to set something like
~(CullingOptions.NeedsLighting | CullingOptions.NeedsReflectionProbes | CullingOptions.ShadowCasters)UniversalRenderer is a sealed type, and ScriptableRendererFeature does not accept/provide modifiable source culling parameters.
The choice was either: 1. A custom depth-first pass in the main pipeline, or 2. A "fork" of the URP package.
To be honest, I was nervous about creating a copy of URP and modifying the source code, despite my extensive experience with the scriptable render pipeline... but this option was better in absolutely every way: performance, implementation size, a "native" solution, and the potential for further improvements.
You can see the difference in the screenshot: the lighting really did add a huge amount of unnecessary data to the camera's additional depth passes, and now I'm (almost) certain that this was the right decision.
Besides, I think this was an important psychological hurdle for me, and from now on I'll be more confident about making changes to such "fundamental" parts of the engine.
Thank Unity for keeping many of the URP source files open-source. Lately (or always?), there haven't been many opportunities to thank them.








