URP – How to overwrite built in shaders

has anybody found a way to overwrite built in shaders (like the grass shader e.g.) if URP is installed using the package manager?
i tried to add a custom package from disc but had no luck.

Can’t you modify the files directly in Library/PackageCache/com.unity.render-pipelines.universal/Shaders/Terrain ? Or do those get overwritten at launch?

that gets overwritten at launch if you use the package manager.

Can you lock the file to stop it from being overwritten or does that crash Unity? Otherwise you could fight back and overwrite Unity’s version with a script that runs when the editor is loaded?

Another option… You could try using the “install from git” option in the package manager instead. Surely that wouldn’t get overwritten?!

when starting unity it checks the packages – and reverts all changes.

Whoa. Not cool if they overwrite a versioned package. What about if you fork the git version? Or create your own branch?
Another idea to try: you could fake the version number or change it in the manifest so that it always appears to be the most recent one.

1 Like

Just move required package from Library/PackageCache to Package (where manifest.json) folder and they won’t be overwritten.

i do not want to remove or change the package, because this is how most people will include urp.
i only want to overwrite a shader…
in legacy it just works be declaring a shader with the same name as it gets compiled/included/idk later as the built in one.
if you have custom shaders you can overwrite a shader by putting the one that shall be used instead in a folder which comes later in alphabetical sort.

Is this still the behavior with Unity 2019.3.15f1? I edited a CS file in URP in the package cache, and my changes survive play mode in the editor as well as making an iOS build.

and restarting unity?

2 Likes

The package cache is not part of the project, so if you share your project (version control or similar), the changes will be overridden (or created from scratch, as the package contents are not included in version control).

The custom package from disc works. That version you can then include into your project so that you can have relative path for the asset (/ProjectName/MyOwnURP - don’t put it under /ProjectName/Assets).

You can also create a git repo and reference that instead. It works just fine. You probably need to make the repo public to avoid hassle with git credentials.