An asset is marked with HideFlags.DontSave but is included in the build: というエラー

症状

Unityでビルド時にAn asset is marked with HideFlags.DontSave but is included in the build:というエラーが出てビルドが通りません。

解決策

当該ファイルをResourcesフォルダの外に出すとビルドが通りました。

参考: https://gist.github.com/RimuruDev/ed6e8b69fcfc4420004c4d928821b102

しかし、Resourcesフォルダから出してもダメなファイルがあり、それはファイルを削除するしかなかったです。意味が分からないです。

このページでは「Project Settingsを消す」という方法が紹介されていたので試してみましたがダメでした。 kasugayu.hatenablog.com