Version: 2020.3
임포터 일관성
에셋 데이터베이스

Asset Metadata

When Unity imports assets, it also stores and manages additional data about the asset for you, such as what import settings should be used to import the asset, and where the asset is used throughout your project. Below is a description of how this process works:

  1. Unity assigns the asset a unique ID.
  2. Unity creates a .meta file to accompany the asset file.
  3. Unity processes the asset.

The Import settings for any given asset affects how Unity processes the asset. If you modifying the asset file, or any of the asset’s import settings, Unity will reimport the asset. For more information, see Assets and their import settings.

고유 ID

Assets 폴더에 텍스처 같은 에셋을 배치하면 Unity가 먼저 새 파일이 추가되었음을 인식합니다. 이는 에디터가 Assets 폴더의 콘텐츠를 기존에 알려진 에셋의 리스트와 대조하여 자주 확인하기 때문입니다.

Unity가 새 파일을 찾으면 에셋에 고유 ID를 할당합니다. Unity가 에셋을 참조하기 위해 내부적으로 사용하는 ID이며, 이를 통해 Unity는 아무런 손상 없이 에셋을 이동하거나 이름을 바꿀 수 있습니다.

The IDs are not normally visible in the Editor,

Meta files

The image below shows .meta files that Unity creates for each item in your project’s Assets folder. Unity creates meta files for asset files and folders.

They are hidden in Unity’s Project window, and you may also find they are hidden in your file system by default, so you may not see them in Windows Explorer or Finder unless you make your hidden files visible on your computer.

The relationship between the Assets folder in your Unity project on your computer, meta files, and the Project window in Unity
The relationship between the Assets folder in your Unity project on your computer, meta files, and the Project window in Unity

이 예제는 시스템 파일 브라우저에 표시되는 것처럼 Unity가 프로젝트의 Assets 폴더 내에 각 에셋 또는 폴더에 대한 .meta 파일을 생성하는 것을 보여줍니다. 하지만 이러한 .meta 파일은 기본적으로 숨김 상태이므로 프로젝트 창에 표시되지 않습니다. Mode 프로젝트 설정에서 Visible Meta Files를 선택하여 숨김 상태를 해제할 수 있습니다.

When Unity creates a .meta file for an asset, it writes the asset’s ID inside the .meta file and stores the .meta file in the same location as the asset file.

As well as the unique ID assigned to the asset, the .meta files contain values for all the import settings you see in the Inspector window when you select an asset in your Project window. For example, for a Texture, this includes the Texture Type, Wrap Mode, Filter Mode and Aniso Level import settings.

에셋에 대한 임포트 설정을 변경하면 새로운 설정이 에셋에 수반되는 .meta 파일에 저장됩니다. Unity는 업데이트된 설정에 따라 에셋을 다시 임포트한 후 그에 따라 프로젝트의 Library 폴더에 있는 임포트된 “게임용” 데이터를 업데이트합니다.

Important: Meta files contain important information about how the asset is used in the Project and they must stay with the asset file they relate to. If you move or rename an asset within Unity’s own Project window, Unity will also automatically move or rename the corresponding .meta file. If you move or rename an asset outside of Unity (i.e. in Windows Explorer, or Finder on macOS), you must move or rename the .meta file to match.

If an asset loses its meta file (for example, if you moved or renamed the asset outside of Unity, without moving/renaming the corresponding .meta file), any reference to that asset will be broken in your project. In this situation, Unity would notice the asset does not have a corresponding meta file and generate a new one for the moved/renamed asset as if it were a brand new asset, and delete the old “orphaned” .meta file.

As an example of the types of problems this could cause, in the case of a texture asset losing its .meta file, any materials which used that texture will now have no reference to that texture. To fix it you would have to manually re-assign that texture to any materials which required it.

Or, in the case of a script asset losing its .meta file, any GameObjects or Prefabs which had that script assigned would end up with an “unassigned script” component, and would lose their functionality. You would have to manually re-assign the script to these objects to fix this.

Empty folders, meta files, and version control

Unity에서 프로젝트의 Assets 폴더 내에 있는 폴더에는 자체 .meta 파일이 할당되지만, 일부 버전 관리 시스템(VCS)은 빈 폴더를 저장할 수 없습니다. 즉 프로젝트에서 빈 폴더를 추가하거나 삭제할 때 VCS는 .meta 파일을 추가 또는 제거된 것으로 저장하지만, 폴더 자체를 추가하거나 제거하는 변경 사항은 저장하지 않으므로 혼란을 일으키거나 문제가 될 수 있습니다.

이 문제를 해결하기 위해 Unity는 빈 폴더에 대해 다음과 같은 방식을 사용합니다.

Unity가 이전에는 메타 파일이 있었지만 지금은 해당 메타 파일이 없는 빈 폴더를 감지하면, VCS의 다른 사용자가 폴더를 삭제하여 메타 파일이 제거되었다고 가정하고 빈 폴더를 로컬에서 삭제합니다.

Unity가 폴더에 대한 새 메타 파일을 감지했지만 해당 폴더가 로컬에 존재하지 않는 경우 Unity는 VCS의 다른 사용자가 폴더를 추가하여 새 메타 파일이 생성된 것으로 간주하고 로컬에 해당하는 빈 폴더를 생성합니다.

임포터 일관성
에셋 데이터베이스
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961