Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

URP – How to overwrite built in shaders

Discussion in 'Universal Render Pipeline' started by larsbertram1, Oct 9, 2019.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,089
    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.
     
  2. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    Can't you modify the files directly in Library/PackageCache/com.unity.render-pipelines.universal/Shaders/Terrain ? Or do those get overwritten at launch?
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,089
    that gets overwritten at launch if you use the package manager.
     
  4. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    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?
     
  5. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    Another option... You could try using the "install from git" option in the package manager instead. Surely that wouldn't get overwritten?!
     
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,089
    when starting unity it checks the packages – and reverts all changes.
     
  7. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    772
    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.
     
  8. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,232
    Just move required package from Library/PackageCache to Package (where manifest.json) folder and they won't be overwritten.
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,089
    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.
     
  10. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    430
    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.
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,089
    and restarting unity?
     
    M_R_M and chrismarch like this.
  12. SampsaPlaysome

    SampsaPlaysome

    Joined:
    Oct 20, 2019
    Posts:
    12
    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.
     
unityunity