Search Issue Tracker

Fixed in 2019.2.X

Votes

8

Found in

2018.1.0b10

Issue ID

1012632

Regression

No

[HDRP] Generating shader includes is broken. Unity package cache permissions issue

Graphics - General

-

How to reproduce:
1. Create empty new 3D project
2. Go to "Package Manager -> All" and install "Render-pipeline.lightweight 1.1.1"
3. In Editor click on Edit -> Render Pipeline -> Upgrade Project Materials...
4. Again, click on Edit -> Render Pipeline -> Generate Shader Includes

Actual result: Generate Shader Include doesn't work and it throws this exception:

UnauthorizedAccessException: Access to the path "C:\ProgramData\Unity\cache\packages\packages.unity.com\com.unity.render-pipelines.core@1.1.1-preview\CoreRP\GeometryUtils.cs.hlsl" is denied.
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path, Boolean append)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool)
System.IO.File.CreateText (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:159)
UnityEditor.Experimental.Rendering.CSharpToHLSL.GenerateAll () (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.render-pipelines.core@1.1.1-preview/CoreRP/Editor/ShaderGenerator/CSharpToHLSL.cs:101)
UnityEditor.Experimental.Rendering.ShaderGeneratorMenu.GenerateShaderIncludes () (at C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.render-pipelines.core@1.1.1-preview/CoreRP/Editor/ShaderGenerator/ShaderGeneratorMenu.cs:10)

Reproduced with: 2018.1.0b12

Comments (5)

  1. dontdiedevelop

    Jul 24, 2018 14:31

    Same issue on 2018.2.0f2 64 bit

  2. Asif362

    Jun 21, 2018 02:16

    I was facing the same issue but managed to solve it. I think it has nothing to do with write permissions. You are probably getting the error because you may have not included the renderingpipeline.core package from the package manager. Importing that package solved the issue for me at least. You should give that a try.

    P.S- I know it's very late but someone else might come in to get help later.

  3. Torigas

    May 01, 2018 13:06

    Potential fix:
    Open the folder described in the error message, select all and remove the "read-only" flag.
    Afterwards I didn't get errors when generating includes.

  4. Torigas

    May 01, 2018 13:03

    Same issue with 2018.1f1

  5. mosaic_school

    Apr 09, 2018 12:04

    Same on with the experimental Unity Linux Editor 2018.1.0b13 and Render-pipelines.core 1.1.2.

    UnauthorizedAccessException: Access to the path "/home/micha/.config/unity3d/cache/packages/packages.unity.com/com.unity.render-pipelines.core@1.1.2-preview/CoreRP/GeometryUtils.cs.hlsl" is denied.
    System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:320)
    System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
    (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
    System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
    System.IO.StreamWriter..ctor (System.String path, Boolean append)
    (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool)
    System.IO.File.CreateText (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:159)
    UnityEditor.Experimental.Rendering.CSharpToHLSL.GenerateAll () (at /home/micha/.config/unity3d/cache/packages/packages.unity.com/com.unity.render-pipelines.core@1.1.2-preview/CoreRP/Editor/ShaderGenerator/CSharpToHLSL.cs:101)
    UnityEditor.Experimental.Rendering.ShaderGeneratorMenu.GenerateShaderIncludes () (at /home/micha/.config/unity3d/cache/packages/packages.unity.com/com.unity.render-pipelines.core@1.1.2-preview/CoreRP/Editor/ShaderGenerator/ShaderGeneratorMenu.cs:10)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.