Search Unity

Resolved Cannot open source file"Packages/com.unity.render-pipelines.core/ShaderLibrary.Common.hlsl"

Discussion in 'Scripting' started by Fedrov, Sep 4, 2020.

  1. Fedrov

    Fedrov

    Joined:
    Sep 4, 2020
    Posts:
    14
    I tried to include the core render pipeline package into my custom one and it just cannot open the source file. Any possible clue?
    Version:2019.4.9f1
    Console:
    Shader error in 'Custom RP/Unlit': failed to open source file: 'Packages/com.unity.render-pipelines.core/ShaderLibrary.Common.hlsl' at Assets/Custom RP/ShaderLibrary/Common.hlsl(8) (on d3d11)

    Compiling Vertex program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR


     
    Last edited: Sep 4, 2020
    amirmasud likes this.
  2. PLSMajesticUnity

    PLSMajesticUnity

    Joined:
    Aug 30, 2020
    Posts:
    10
    From my perspective it's installed and the file is imprted to the project.
     
  3. ForMyDreams

    ForMyDreams

    Joined:
    Nov 4, 2017
    Posts:
    5
    Just remove "Library" folder and reopen unity.
     
  4. LPsir

    LPsir

    Joined:
    Aug 26, 2021
    Posts:
    1
    I did it, but the program still reports errors。 help me
     
  5. DomeCreator

    DomeCreator

    Joined:
    Mar 5, 2020
    Posts:
    29
    Hello @LPsir
    I go the same issue, did you find a solution ?

    I saw the package isn't be searched at the right place, but I have no idea how to setup the right folder.
     
    Last edited: Nov 4, 2021
    huchika likes this.
  6. Morakito

    Morakito

    Joined:
    Dec 23, 2021
    Posts:
    2
    In Unity2018 and before, the editor feature [ShaderIncludePath] was used to configure the relative root of the shader, which is now obsolete.
    The current method is that #include "Packages/<package name>/<relative file path>",ShaderLab will parse and configure by itself when linking, but VS does not recognize this writing method and still links according to the default relative path of HLSL files, so an error will be reported, but compilation will not be affected
     
    KalyanKP, spamove and amirmasud like this.
  7. Keean07

    Keean07

    Joined:
    Apr 23, 2023
    Posts:
    1
    Okay so I tried something. Although my shaders compile, I also get the IDE errors by the #include statements. So my assumption was that the problem was with the .shader file type that unity creates. So, while in the project folder in VS, I created a new file with the type .hlsl (ensure you have the hlsl support package installed). I then copied the code from my shader file into the HLSL file and it gave me no errors and the editor worked way better than it does with .shader files. So I think from now on, I'll write the code in a .hlsl file, and when I see that there are no errors, I will copy and paste it to the .shader file for compilation, until I can figure out how to use a .hlsl file for the shader.
     
  8. hypochlorous

    hypochlorous

    Joined:
    Jan 17, 2024
    Posts:
    1
    I changed the order in my common.hlsl, define the unitymatrix macro before the #include spacetransforms.hlsl and place common before unityinput.hlsl to find the definition the type of real;Although IDE still report errors,I can see the shader,material and the editor report no error;