Search Unity

Shadergraph subgraph importing bug on shared project

Discussion in 'Shaders' started by mattbirkettsmith, Oct 8, 2018.

  1. mattbirkettsmith

    mattbirkettsmith

    Joined:
    Mar 19, 2018
    Posts:
    8
    I have a very nasty issue in a project I'm working on that uses HDRP, Shadergraph and Subgraphs. The project is designed to be shareable with other users.

    I have multilple shaders that share use of 2 common subgraphs for neatness, both of these subgraphs primarily effect emissive on the shaders.

    I've noticed that when sharing the project to other users that on their initial install these shaders are broken, the subgraphs are not getting used and the shaders have no emissive contribution at all.

    However if I do a quick reimport on the shader files this completely fixes the issue.

    I have a suspicion that the following is happening:
    I think the main shaders get compiled first, and see a link to a subgraph that is not yet compiled so is ignored or skipped
    Then the subgraphs get compiled
    Then if you reimport the shaders they find the subgraphs so it applies them properly

    I've also tested that if I clear my Unity library cache and reopen the project it initialises with broken shaders.

    It's not really acceptable for me in this use case to tell everyone who wants to work on the project to do a manual reimport on the shaders folder as it makes the project look unprofessional.

    Does anyone have any suggestions for how I could fix the above in a way that looks clean to the end user? I know I could delete the subgraphs and bring them directly into the main shaders but this seems like a poor option.
     
    m_hakozaki and oliverbalaam like this.