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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Shaders not being updated in build

Discussion in 'Shaders' started by ScottieBizzle, Aug 9, 2016.

  1. ScottieBizzle

    ScottieBizzle

    Joined:
    Nov 9, 2013
    Posts:
    17
    My shaders are being updated fine in the editor Scene and Game view when edited externally, but only old versions of the shaders are being picked up by builds.

    I do have multiple shaders ( shaderlab and compute shaders ) added to a deeper sub-directory of my project's asset folder. These shaders are not referenced by materials in the editor, because I create materials which reference them at run-time. So I made sure to add them all to a folder named "Resources" which is supposed to make sure they get picked up. They must have got picked up on the first "build" because it renders an old version of the shader, but now nothing I do to the shaders get picked up in the build. I even tried deleting the shader cache from the project and building into a clean directory.

    Is this a known bug or am I losing my mind? :)

    Scott
     
  2. ScottieBizzle

    ScottieBizzle

    Joined:
    Nov 9, 2013
    Posts:
    17
    SOLVED, but have another problem.

    First issue was that I had two render shaders with the same name, and two compute shaders with the same filename so Unity must have loaded them all, but was passing back the first one it found when calling Resources.Load(..) and Shader.Find(..). Renaming them to be unique across the project solved that issue.

    Now, it seems like my compute shaders are not working in my build for some reason...
     
  3. ScottieBizzle

    ScottieBizzle

    Joined:
    Nov 9, 2013
    Posts:
    17
    Solved the second issue. The compute shaders were fine, my render targets were being reset by engine after they were initialized from the Start function for some reason, now I just check IsCreated() before using them again and recreate them if needed... I guess this does not happen in the scene/game view of the editor.