어떤 상황에서는 씬의 일부로 로드하지 않고 프로젝트에서 사용할 수 있게 하는 것이 유용합니다. 예를 들어, 게임의 모든 씬에 등장할 수 있지만 드물게 사용되는 캐릭터 또는 기타 오브젝트가 있을 수 있습니다(가령 이것은 “비밀” 기능, 오류 메시지 또는 하이스코어 알림일 수 있습니다). 또한, 초기 다운로드 시간을 단축하거나 게임 콘텐츠를 교체하기 위해 별도의 파일 또는 URL에서 에셋을 로드할 수 있습니다.
You can use Resource Folders in your project to include content in your player build, which will make it available to load when needed, independently of the scenes that you build.
Resource Folders contain collections of assets that are included in the built Unity player even when they are not directly referenced from any Scene included the Build.
To put assets into a Resource Folder, create a new folder in the Project window, and name the folder “Resources”. You can have multiple Resource Folders located at different subfolders within your Assets folder, and packages may also contain Resources folders. You can then place assets into that folder in the same way as any other folder in the Project window. Whenever you want to load an asset from one of these folders, call Resources.Load().
Note: All assets found in the Resources folders and their dependencies are stored in a file in the build output called resources.assets. If a scene in the build references an asset then that asset is serialized into a sharedAssets*.assets file instead.
Only assets that are in the Resources folder can be accessed through Resources.Load(). However many more assets might end up in the resources.assets file since they are dependencies. For example a Material in the Resources folder might reference a Texture outside of the Resources folder. In that case the Texture is also included in the resources.assets file, but it is not available to load directly.
If you want to destroy scene objects that were loaded using Resources.Load() prior to loading another scene, call Object.Destroy() on them. To release assets and reclaim memory, use Resources.UnloadUnusedAssets().
The Resources system is convenient to use, especially for rapid prototyping and small projects. But it does not scale well and overall use of this feature is discouraged. For this reason AssetBundles and the Addressables package are the recommended alternative.
Some downsides of using Resources:
The resources folder can be appropriate for small Assets that are required throughout the project’s lifetime, that do not require updates, and do not vary across platforms or devices. Resource assets might be part of the minimal bootstrapping for a game, with the main content downloaded on-demand with AssetBundles. But local AssetBundles located in the StreamingAssets folder could also serve that bootstrapping need.