Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Custom shader works on editor, doesn't work on built project

Discussion in 'Shader Graph' started by fr4ct1ons, Nov 13, 2019.

  1. fr4ct1ons

    fr4ct1ons

    Joined:
    Jan 24, 2019
    Posts:
    1
    Hey there! I've been working on a custom shader with Shader Graph on LWRP for a while and it works just how I want on the editor. However, if I build the project package (i.e the executable) the custom shader does not work, it looks gray. Here's what I mean.
    The top image is the built game while the bottom one is inside the editor. The model on the left uses the standard LWRP lit shader while the one on the right uses the custom shader I made.
    I suppose it's something to do with some compiler tag that isn't being defined when the project is compiled, as this only happens on the built project.
    I'm using 2019.2.5f1. Already tried to change to 2019.2.11f1, 2019.3 beta and 2020.1 alpha. It still doesn't work.
    I'm following this tutorial https://connect.unity.com/p/zelda-inspired-toon-shading-in-shadergraph and part of this tutorial, for getting the additional lights https://blogs.unity3d.com/2019/07/31/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019/
    Notice that on the first link, the shader graph is sent to emission, not Albedo. I suppose this may have to do with the issue.
    I am using the HLSL methods in the CustomMethods file I provided. I changed the extension to txt just to allow for upload, but on the project, it is a .hlsl. I'm using the MainLightNode and AllLightsNode methods, which are used together in a custom function node to get all lights.
    I guess that's all. Any help will be appreciated!
     

    Attached Files:

  2. SergeyDoes

    SergeyDoes

    Joined:
    Jan 18, 2017
    Posts:
    1
    Hey! Have you managed to solve the problem? I am getting the same trouble in URP using Shader Graph