I want to avoid including assets that have become garbage and have no references, such as assets used in Debug, or assets that were used in the early stages of development but are no longer used, when packaging.
It seems like I should add a process to do this somewhere in UAssetManager, but I don’t know where it would be appropriate to do this. If anyone knows, could you tell me?
The default of the cooking process is to include all the project’s asset. You can change this by specifying a “list of maps to include in a packaged build” in the the project settings. This will have the cooking process to only consider the assets in the specified levels and the full chain of dependencies. Unreferenced assets should not be part of the project anymore unless they are under an “Additional Asset Directories to Cook” (in the settings).
Assets that are not referenced by the cooked content will never be part of a package.
There are a couple of ways that you can detect\prevent referencing assets:
Project Setting\Packaging\“Directories to never cook”: Manage a list of folders that will be excluded when cooking. An error will fail the packaging If a cooked assets references an asset in that folder.
AssetReferenceRestrictions: This plugin allows to configure " Asset Referencing Policy" in the project settings