This is part 3 of the examples from Object linking and embedding – Smart workflows for game developers.
Assets in Unity are linked files. They all contain a reference to their original source file, enabling automatic updates, when changes are made.
To force asset update, right click on a file and select Reimport.
It is important to note, that there is more information to an asset than just the source file:
To every imported asset, there is a hidden .meta file which contains the link and saves changes made in the Inspector.
This .meta file is extremely important to Unity!
If the .meta file connection is somehow lost for an asset, you might not notice an error, but Unity will no longer update the file correctly. When working in a team this can lead to confusion and broken assets.
Here’s how to avoid problems:
- Always import assets via the Unity Project pane
- When making changes to files, have Unity open and save your project, so that the .meta files are updated as well
- When working with version control, make the following adjustments in Edit > Project Settings > Editor:
This will show .meta files, which is vital when working with Subversion, Git, Mercurial or any other version control system.
When Unity imports an asset it creates a GUID (Globally Unique Identifier). This number represents the link between the editor and the source file. If you are working in a team with version control and somebody imports assets into the project via the operating system’s file browser instead of Unity, it might lead to conflicts.
Unity tip: It is possible to edit .meta files from the outside Unity, if you know, what you’re doing. You could do a search and replace text on multiple .meta files without opening up Unity. This can be helpful if you’re trying to fix a problem that resulted from merging .meta files in your version control system.