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

Exclude files from Unity packages in build

Discussion in 'Editor & General Support' started by uwdlg, Feb 16, 2021.

  1. uwdlg

    uwdlg

    Joined:
    Jan 16, 2017
    Posts:
    142
    Hi,

    looking at a recent build report, I noticed that when using the Universal Render Pipeline package, several files are "unnecessarily" included in the build (for example textures related to post processing effects I'm not using, e.g. Packages/com.unity.render-pipelines.universal/Textures/FilmGrain/*.png). Since my target platform is WebGL, it would be nice to exclude those files and save a few more megabytes.

    Is there some way to manually exclude specific files (from packages, not Assets/) from a build?
     
  2. uwdlg

    uwdlg

    Joined:
    Jan 16, 2017
    Posts:
    142
    I believe I have found a way to do this, though it is not exactly flexible.
    I copied the package in question from the PackageCache folder to another location, removed the package in the package manager and added it again from the other location as a local package. This allows me to modify the package files, so I deleted the files I don't use and built the project - that seems to work.
    However a different way to just blacklist the files included in the build somehow would be preferable so I won't be cut off from package updates...