Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Material not updating when shader code is changed

Discussion in 'WebGL' started by monark, Aug 11, 2022.

  1. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,593
    What's the trick to getting Unity to recognise your shader code has changed and a new compile needs to be included in the build?

    I've been trying all afternoon to get a change to show up in the browser and it's just not having it.

    It all works fine in the Editor but no matter what I do, including completely deleting the shader cache will persuade it to show up in the final build.

    I've also tried renaming the shader file, reimporting it and deleting the BuildCache. Short of nixing the entire Library I'm stuck. There has to be an easier way surely??

    I'm using URP and have data caching turned on.

    I can see other things updating as normal it's only the material that refuses to change.

    [EDIT: even after completely rebuilding the library it's still the same. What witch craft is this. Where is it getting the old material from???]
     
    Last edited: Aug 11, 2022
  2. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,593
    Arrrrggghhhhh Addressables!!!

    So even the shader code is stored an addressable and no amount of updating works without rebuilding all the addressable assets that reference them.