Unity meta файлы что это
Когда Unity импортирует ресурсы, она также сохраняет и управляет дополнительными данными об этом ресурсе, например, какие настройки импорта Unity должна использовать для импорта ресурса и где этот ресурс используется в вашем проекте. Ниже приведено описание того, как работает этот процесс:
- Unity присваивает объекту уникальный идентификатор.
- Unity создает файл .meta , сопровождающий файл ресурса.
- Unity обрабатывает ресурс.
Настройки импорта для любого ресурса влияют на то, как Unity обрабатывает этот ресурс. Если вы измените файл ассета или любые настройки импорта ассета, Unity повторно импортирует ассет. Дополнительную информацию см. в разделе Объекты и настройки их импорта.
Метафайлы
На изображении ниже показаны файлы .meta , которые Unity создает для каждого элемента в папке Assets вашего проекта. Unity создает метафайлы для файлов и папок активов.
Эти файлы скрыты в окне проекта Unity окне, которое показывает содержимое вашего Папка Assets (вкладка Project) Подробнее
См. в Словарь , а также может быть скрыт в вашей файловой системе по умолчанию ( см. Википедия: Скрытый файл и скрытый каталог), поэтому вы можете не увидеть их в Проводнике Windows или Finder. если только вы не сделаете скрытые файлы видимыми на своем компьютере.
Связь между папкой Assets в проекте Unity на вашем компьютере, метафайлами и окном проекта в Unity.
В этом примере показано, что Unity создает файл .meta для каждого ресурса или папки в папке проекта Assets , поскольку они появляются в браузере системных файлов. Однако эти файлы .meta не отображаются в окне проекта, поскольку по умолчанию они скрыты. Чтобы сделать их видимыми, откройте параметр проекта Mode и включите Видимые метафайлы.
Когда Unity создает файл .meta для объекта, он записывает идентификатор объекта в файл .meta и сохраняет файл .meta в том же месте, что и файл ресурса.
Файлы .meta содержат уникальный идентификатор, присвоенный ресурсу, и значения для всех настроек импорта. вы видите в Инспекторе окно Unity, в котором отображается информация о текущем выбранном игровом объекте, активе или настройках проекта, что позволяет вам проверять и редактировать значения. Подробнее
Просмотр в окне Словарь при выборе ресурса в Окно проекта. Например, для текстуры это включает Тип текстуры, Режим переноса, Режим фильтра и Уровень Aniso Уровень анизотропной фильтрации (AF) текстуры. Позволяет повысить качество текстуры при просмотре текстуры под крутым углом. Подходит для текстур пола и земли. Подробнее
См. в Словарь .
Если вы измените настройки импорта для ресурса, Unity сохранит эти новые настройки в файле .meta , который сопровождает ресурс. Затем Unity повторно импортирует ресурс в соответствии с вашими обновленными настройками и обновляет соответствующие импортированные «готовые к игре» данные в папке проекта Library .
Sometimes multiple assets are created from an import
Some asset files can result in multiple assets being created. This can occur in the following situations:
A 3D file, such as an FBX, defines Materials and/or contains embedded Textures.
In this case, the defined Materials and embedded textures are extracted and represented in Unity as separate assets.
An image file imported as multiple sprites.
It’s possible to define multiple sprites from a single graphic image, by using Unity’s Sprite Editor. In this case, each sprite defined in the editor will appear as a separate Sprite asset in the Project window.
A 3D file contains multiple animation timelines, or has multiple separate clips defined within its animation import settings.
In this situation, the multiple animation clips will appear as separate Animation Clip assets in the project window.
1. A Unique ID is assigned
When you place an Asset such as a texture in the Assets folder, Unity will first detect that a new file has been added (the editor frequently checks the contents of the Assets folder against the list of assets it already knows about).
The first step Unity takes it to assign a unique ID to the asset. This ID is used internally by Unity to refer to the asset which means the asset can be moved or renamed without references to the asset breaking.
Метафайлы и файлы ресурсов
Важно. Метафайлы содержат важную информацию о том, как актив используется в проекте, и они должны оставаться в файле актива, к которому они относятся. Если вы перемещаете или переименовываете ресурс в собственном окне проекта Unity, Unity также автоматически перемещает или переименовывает соответствующий файл .meta. Однако если вы перемещаете или переименовываете ресурс за пределами Unity (то есть в Проводнике Windows или Finder в macOS), вы должны переместить или переименовать файл .meta, чтобы он соответствовал.
Если ресурс теряет свой метафайл (например, если вы перемещаете или переименовываете ресурс за пределами Unity, но не перемещаете или переименовываете соответствующий файл .meta), любая ссылка на этот ресурс в вашем проекте не работает. В этой ситуации Unity замечает, что у ресурса нет соответствующего метафайла, создает новый для перемещенного/переименованного ресурса, как если бы это был совершенно новый ресурс, и удаляет старый «бесхозный» файл .meta.
Unique IDs
The Unity Editor frequently checks the contents of the Assets folder against the list of assets it already knows about. When you place an asset in the Assets folder, Unity detects that you have added a new file.
When Unity finds the new file, it assigns a unique ID to the asset. This is an ID that Unity uses internally to reference the asset, so that Unity can move or rename the asset without breaking anything.
The IDs are not normally visible in the Editor,
Empty folders, meta files, and version control
Unity assigns each folder in your project’s Assets folder its own .meta file. However, some version control A system for managing file changes. You can use Unity in conjunction with most common version control tools, including Perforce, Git, Mercurial and PlasticSCM. More info
See in Glossary systems (VCS) can’t store empty folders. This means that when you add or delete an empty folder from your project, your VCS stores the .meta file as added or removed, but doesn’t store the change of adding or removing the folder itself, which can be confusing or problematic.
To help with this issue, Unity behaves in the following specific ways relating to empty folders:
If Unity detects an empty folder that no longer has a corresponding meta file, when that folder previously had a meta file, Unity assumes the meta file was removed via the deletion of the folder by another user in your VCS, and deletes the empty folder locally.
If Unity detects a new meta file for a folder, but that folder does not exist locally, Unity assumes the new meta file was created via to the addition of the folder by another user in the VCS, and creates the corresponding empty folder locally.
Unity automatically imports assets and manages various kinds of additional data about them 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.
2. A .meta file is created
The relationship between the Assets Folder in your Unity Project on your computer, and the Project Window within Unity
You’ll notice in the image above that there are .meta files listed in the file system for each asset and folder created within the Assets folder. These are not visible in Unity’s Project Window. Unity creates these files for each asset, but they are hidden by default, so you may not see them in your Explorer/Finder either. You can make them visible by selecting this option in Unity: Edit > Project Settings > Editor > Versions Control, Mode : Visible Meta Files.
The ID that Unity assigns to each asset is stored inside the .meta file which Unity creates alongside the asset file itself. This .meta file must stay with the asset file it relates to.
IMPORTANT: .meta files must match and stay with their respective asset files. 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 the Mac), 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. Unity would generate a new .meta file for the moved/renamed asset as if it were a brand new asset, and delete the old “orphaned” .meta file.
For example, 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.
In the case of a script asset losing its .meta file, any Game Objects or Prefabs which had that script assigned would end up with an “unassaigned script” component, and would lose their functionality. You would have to manually re-assign the script to these objects to fix this.
Unique IDs
The Unity Editor frequently checks the contents of the Assets folder against the list of assets it already knows about. When you place an asset in the Assets folder, Unity detects that you have added a new file.
When Unity finds the new file, it assigns a unique ID to the asset. This is an ID that Unity uses internally to reference the asset, so that Unity can move or rename the asset without breaking anything.
The IDs are not normally visible in the Editor,
Meta files and asset files
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 also automatically moves or renames the corresponding .meta file. However, if you move or rename an asset outside of Unity (that is, 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 move or rename the asset outside of Unity, but don’t move or rename the corresponding .meta file), any reference to that asset is broken in your project. In this situation, Unity notices that the asset does not have a corresponding meta file, generates a new one for the moved/renamed asset as if it is a brand new asset, and deletes the old “orphaned” .meta file.
This process can cause significant problems in your project. For example: * If a texture asset loses its .meta file, any materials that use that texture lose their reference to that texture. To fix it, you would need to manually re-assign that texture to any materials which require it. * If a script asset loses its .meta file, any GameObjects The fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary or Prefabs An asset type that allows you to store a GameObject complete with components and properties. The prefab acts as a template from which you can create new object instances in the scene. More info
See in Glossary that have that script assigned instead have an “unassigned script” component, and lose their functionality. To fix it, you would need to manually re-assign that script to any GameObjects which require it.
Пустые папки, метафайлы и контроль версий
Unity назначает каждой папке в папке Assets вашего проекта собственный файл .meta . Однако некоторая система управления версиями для управления изменениями файлов. Вы можете использовать Unity в сочетании с наиболее распространенными инструментами контроля версий, включая Perforce, Git, Mercurial и PlasticSCM. Дополнительная информация
См. в Словарь системы (VCS) не могут хранить пустые папки. Это означает, что когда вы добавляете или удаляете пустую папку из своего проекта, ваша система контроля версий сохраняет файл .meta как добавленный или удаленный, но не сохраняет изменение добавления или удаления сама папка, что может сбивать с толку или создавать проблемы.
Чтобы решить эту проблему, Unity ведет себя следующим образом в отношении пустых папок:
Если Unity обнаруживает пустую папку, в которой больше нет соответствующего метафайла, если в этой папке ранее был метафайл, Unity предполагает, что метафайл был удален путем удаления папки другим пользователем в вашей системе контроля версий, и удаляет пустая папка локально.
Если Unity обнаруживает новый метафайл для папки, но эта папка не существует локально, Unity предполагает, что новый метафайл был создан путем добавления папки другим пользователем в системе контроля версий, и создает соответствующую пустую папку. локально.
Данная страница нуждается в модернизации. Пожалуйста, помогите нам улучшить качество данной страницы, отредктировав её содержимое. Для этого Войдите на сайт, или Зарегистрируйтесь
When Unity imports assets, it also stores and manages additional data about the asset, such as what import settings Unity should use to import the asset, and where the asset is used throughout your project. Below is a description of how this process works:
- Unity assigns the asset a unique ID.
- Unity creates a .meta file to accompany the asset file.
- Unity processes the asset.
The Import settings for any given asset affects how Unity processes the asset. If you modify the asset file, or any of the asset’s import settings, Unity reimports the asset. For more information, see Assets and their import settings.
2. A .meta file is created
The relationship between the Assets Folder in your Unity Project on your computer, and the Project Window within Unity
You’ll notice in the image above that there are .meta files listed in the file system for each asset and folder created within the Assets folder. These are not visible in Unity’s Project Window. Unity creates these files for each asset, but they are hidden by default, so you may not see them in your Explorer/Finder either. You can make them visible by selecting this option in Unity: Edit > Project Settings > Editor > Versions Control, Mode : Visible Meta Files.
The ID that Unity assigns to each asset is stored inside the .meta file which Unity creates alongside the asset file itself. This .meta file must stay with the asset file it relates to.
IMPORTANT: .meta files must match and stay with their respective asset files. 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 the Mac), 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. Unity would generate a new .meta file for the moved/renamed asset as if it were a brand new asset, and delete the old “orphaned” .meta file.
For example, 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.
In the case of a script asset losing its .meta file, any Game Objects or Prefabs which had that script assigned would end up with an “unassaigned 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 assigns each folder in your project’s Assets folder its own .meta file. However, some version control A system for managing file changes. You can use Unity in conjunction with most common version control tools, including Perforce, Git, Mercurial and PlasticSCM. More info
See in Glossary systems (VCS) can’t store empty folders. This means that when you add or delete an empty folder from your project, your VCS stores the .meta file as added or removed, but doesn’t store the change of adding or removing the folder itself, which can be confusing or problematic.
To help with this issue, Unity behaves in the following specific ways relating to empty folders:
If Unity detects an empty folder that no longer has a corresponding meta file, when that folder previously had a meta file, Unity assumes the meta file was removed via the deletion of the folder by another user in your VCS, and deletes the empty folder locally.
If Unity detects a new meta file for a folder, but that folder does not exist locally, Unity assumes the new meta file was created via to the addition of the folder by another user in the VCS, and creates the corresponding empty folder locally.
Уникальные идентификаторы
Редактор Unity часто сверяет содержимое папки Assets со списком уже известных ему ресурсов. Когда вы помещаете ресурс в папку Assets , Unity обнаруживает, что вы добавили новый файл.
Когда Unity находит новый файл, он присваивает объекту уникальный идентификатор. Это идентификатор, который Unity использует внутри для ссылки на ресурс, чтобы Unity могла перемещать или переименовывать ресурс, ничего не нарушая.
Идентификаторы обычно не отображаются в редакторе,
3. The source asset is processed
Unity reads and processes any files that you add to the Assets folder, converting the contents of the file to internal game-ready versions of the data. The actual asset files remain unmodified, and the processed and converted versions of the data are stored in the project’s Library folder.
Using internal formats for assets allows Unity to have game-ready versions of your assets ready to use at runtime in the editor, while keeping your unmodified source files in the the assets folder so that you can quickly edit them and have the changes automatically picked up by the editor. For example, the Photoshop file format is convenient to work with and can be saved directly into your Assets folder, but hardware such as mobile devices and PC graphics cards can’t accept that format directly to render as textures. All the data for Unity’s internal representation of your assets is stored in the Library folder which can be thought of as similar to a cache folder. As a user, you should never have to alter the Library folder manually and attempting to do so may affect the functioning of the project in the Unity editor. However, it is always safe to delete the Library folder (while the project is not open in Unity) as all its data is generated from what is stored in the Assets and ProjectSettings folders. This also means that the Library folder should not be included in version control.
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.
These files are hidden in Unity’s Project window A window that shows the contents of your Assets folder (Project tab) More info
See in Glossary , and might also be hidden in your file system by default (see Wikipedia: Hidden file and hidden directory), so you might 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
This example demonstrates that Unity creates a .meta file for each asset or folder inside the project’s Assets folder, because they appear in a system file browser. However, these .meta files are not visible in the Project window because they are hidden by default. To make them visible, open the Mode project setting and enable 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.
The .meta files contain the unique ID assigned to the asset, and values for all the import settings you see in the Inspector A Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary 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 The anisotropic filtering (AF) level of a texture. Allows you to increase texture quality when viewing a texture at a steep angle. Good for floor and ground textures. More info
See in Glossary import settings.
If you change the import settings for an asset, Unity saves those new settings to the .meta file that accompanies the asset. Unity then re-imports the asset according to your updated settings, and updates the corresponding imported “game-ready” data in the project’s Library folder.
Sometimes multiple assets are created from an import
Some asset files can result in multiple assets being created. This can occur in the following situations:
A 3D file, such as an FBX, defines Materials and/or contains embedded Textures.
In this case, the defined Materials and embedded textures are extracted and represented in Unity as separate assets.
An image file imported as multiple sprites.
It’s possible to define multiple sprites from a single graphic image, by using Unity’s Sprite Editor. In this case, each sprite defined in the editor will appear as a separate Sprite asset in the Project window.
A 3D file contains multiple animation timelines, or has multiple separate clips defined within its animation import settings.
In this situation, the multiple animation clips will appear as separate Animation Clip assets in the project window.
Meta files and asset files
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 also automatically moves or renames the corresponding .meta file. However, if you move or rename an asset outside of Unity (that is, 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 move or rename the asset outside of Unity, but don’t move or rename the corresponding .meta file), any reference to that asset is broken in your project. In this situation, Unity notices that the asset does not have a corresponding meta file, generates a new one for the moved/renamed asset as if it is a brand new asset, and deletes the old “orphaned” .meta file.
This process can cause significant problems in your project. For example: * If a texture asset loses its .meta file, any materials that use that texture lose their reference to that texture. To fix it, you would need to manually re-assign that texture to any materials which require it. * If a script asset loses its .meta file, any GameObjects The fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary or Prefabs An asset type that allows you to store a GameObject complete with components and properties. The prefab acts as a template from which you can create new object instances in the scene. More info
See in Glossary that have that script assigned instead have an “unassigned script” component, and lose their functionality. To fix it, you would need to manually re-assign that script to any GameObjects which require it.
What happens when Unity imports an Asset?
3. The source asset is processed
Unity reads and processes any files that you add to the Assets folder, converting the contents of the file to internal game-ready versions of the data. The actual asset files remain unmodified, and the processed and converted versions of the data are stored in the project’s Library folder.
Using internal formats for assets allows Unity to have game-ready versions of your assets ready to use at runtime in the editor, while keeping your unmodified source files in the the assets folder so that you can quickly edit them and have the changes automatically picked up by the editor. For example, the Photoshop file format is convenient to work with and can be saved directly into your Assets folder, but hardware such as mobile devices and PC graphics cards can’t accept that format directly to render as textures. All the data for Unity’s internal representation of your assets is stored in the Library folder which can be thought of as similar to a cache folder. As a user, you should never have to alter the Library folder manually and attempting to do so may affect the functioning of the project in the Unity editor. However, it is always safe to delete the Library folder (while the project is not open in Unity) as all its data is generated from what is stored in the Assets and ProjectSettings folders. This also means that the Library folder should not be included in version control.
What happens when Unity imports an Asset?
1. A Unique ID is assigned
When you place an Asset such as a texture in the Assets folder, Unity will first detect that a new file has been added (the editor frequently checks the contents of the Assets folder against the list of assets it already knows about).
The first step Unity takes it to assign a unique ID to the asset. This ID is used internally by Unity to refer to the asset which means the asset can be moved or renamed without references to the asset breaking.
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.
These files are hidden in Unity’s Project window A window that shows the contents of your Assets folder (Project tab) More info
See in Glossary , and might also be hidden in your file system by default (see Wikipedia: Hidden file and hidden directory), so you might 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
This example demonstrates that Unity creates a .meta file for each asset or folder inside the project’s Assets folder, because they appear in a system file browser. However, these .meta files are not visible in the Project window because they are hidden by default. To make them visible, open the Mode project setting and enable 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.
The .meta files contain the unique ID assigned to the asset, and values for all the import settings you see in the Inspector A Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary 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 The anisotropic filtering (AF) level of a texture. Allows you to increase texture quality when viewing a texture at a steep angle. Good for floor and ground textures. More info
See in Glossary import settings.
If you change the import settings for an asset, Unity saves those new settings to the .meta file that accompanies the asset. Unity then re-imports the asset according to your updated settings, and updates the corresponding imported “game-ready” data in the project’s Library folder.
The import settings can alter the processing of the asset
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 when you have an asset selected in your project window. For a texture, this includes settings such as the Texture Type, Wrap Mode, Filter Mode and Aniso Level.
If you change the import settings for an asset, those changed settings are stored in the .meta file accompanying the asset. The asset will be re-imported according to your new settings, and the corresponding imported “game-ready” data will be updated in the project’s Library folder.
When backing up a project, or adding a project to a Version Control Repository, you should include the main Unity project folder, containing both the Assets and ProjectSettings folders. All the information in these folders is crucial to the way Unity works. You should omit the Library and Temp folders for backup purposes.
Note: Projects created in Unity 4.2 and earlier may not have .meta files if not explicitly enabled. Deleting the Library folder in these projects will lead to data loss and permanent project corruption because both the generated internal formats of your assets and the meta data were stored in the Library folder.
Unity automatically imports assets and manages various kinds of additional data about them 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.
The import settings can alter the processing of the asset
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 when you have an asset selected in your project window. For a texture, this includes settings such as the Texture Type, Wrap Mode, Filter Mode and Aniso Level.
If you change the import settings for an asset, those changed settings are stored in the .meta file accompanying the asset. The asset will be re-imported according to your new settings, and the corresponding imported “game-ready” data will be updated in the project’s Library folder.
When backing up a project, or adding a project to a Version Control Repository, you should include the main Unity project folder, containing both the Assets and ProjectSettings folders. All the information in these folders is crucial to the way Unity works. You should omit the Library and Temp folders for backup purposes.
Note: Projects created in Unity 4.2 and earlier may not have .meta files if not explicitly enabled. Deleting the Library folder in these projects will lead to data loss and permanent project corruption because both the generated internal formats of your assets and the meta data were stored in the Library folder.
When Unity imports assets, it also stores and manages additional data about the asset, such as what import settings Unity should use to import the asset, and where the asset is used throughout your project. Below is a description of how this process works:
- Unity assigns the asset a unique ID.
- Unity creates a .meta file to accompany the asset file.
- Unity processes the asset.
The Import settings for any given asset affects how Unity processes the asset. If you modify the asset file, or any of the asset’s import settings, Unity reimports the asset. For more information, see Assets and their import settings.
Читайте также: