This area of the Unity User Manual provides a general overview of the principles of working with assets in Unity, including the following topics:
.unitypackage
extension. Asset packages are a handy way of sharing and re-using Unity projects and collections of assets. More infoAlso see the following related topics in other sections of the manual:
An asset is a representation of any item you can use in your project. An asset might come from a file created outside of Unity, such as a 3D Model, an audio file, or an image. You can create some asset types in Unity, such as a ProBuilder MeshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
See in Glossary, an Animator ControllerControls animation through Animation Layers with Animation State Machines and Animation Blend Trees, controlled by Animation Parameters. The same Animator Controller can be referenced by multiple models with Animator components. More info
See in Glossary, an Audio Mixer, or a Render TextureA special type of Texture that is created and updated at runtime. To use them, first create a new Render Texture and designate one of your Cameras to render into it. Then you can use the Render Texture in a Material just like a regular Texture. More info
See in Glossary.
Unity automatically imports assets and manages 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:
In some cases, Unity might create multiple assets while importing a single asset file. For more information, see Importing complex assets.
Import settings can affect how Unity processes assets. For more information, see Assets and their import settings.
When you place an asset such as a Texture in the Assets
folder, Unity detects that you have added a new file because the Editor frequently checks the contents of the Assets
folder against the list of assets it already knows about.
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.
This example shows that Unity creates a .meta
file for each asset or folder inside the project’s Assets
folder, as they appear in a system file browser. However, these .meta
files are not visible in the Project windowA window that shows the contents of your Assets
folder (Project tab) More info
See in Glossary because they are hidden by default. You can make them visible by selecting Visible Meta Files from the Mode project setting.
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
file must stay in the same location as the asset file it relates to, because it contains the asset’s ID. If you move or rename an asset within the Project window, Unity automatically moves or renames the corresponding .meta
file. However, if you move or rename an asset outside of Unity (for example, through your system’s file browser), make sure you 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’s Project window, without updating its .meta
file), any reference to that asset breaks, and Unity generates a new .meta
file for the asset as if it were a different asset, deleting the old “orphaned” .meta
file.
For example, in the case of a Texture asset losing its .meta
file, any Materials that used that Texture no longer have a reference to the Texture. To fix this, you would have to manually re-assign that Texture to any Materials which required it.
Similarly, when a script asset attached to a GameObjectThe 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 Prefab) loses its .meta
file, that GameObject loses the script’s functionality, and ends up with an “unassigned script” component. To fix this, you must manually re-assign the script to the GameObject.
Unity reads and processes any files that you add to the Assets
folder, converting the contents of the file to internal game-ready data. The asset files themselves remain unchanged, and the internal data is 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 Assets
folder. Keeping the internal formats separate from the asset files means that you can quickly edit them and have the Editor pick up the changes automatically. For example, the Photoshop file format is convenient and you can save .psd
files directly into your Assets
folder, but hardware such as mobile devices and PC graphics cards can’t process that format directly in order to render them as Textures.
Unity stores the internal representation of your assets in the Library
folder which is like a cache folder. As a user, you should never have to alter the Library
folder manually, and attempting to do so may negatively affect your project in the Unity Editor. However, as long as the project is not open in Unity, you can safely delete the Library
folder, because Unity can regenerate all of its data from the Assets
and ProjectSettings
folders. This also means that you should not include the Library
folder under version controlA 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.
Sometimes Unity creates multiple assets when it imports a single asset file. For example, this can occur in the following situations:
Import scenario: | How Unity handles the file: |
---|---|
When a 3D file (such as an FBX file) defines Materials or contains embedded Textures. | Unity extracts the Materials and embedded Textures as separate assets. |
When you want to import an image file as multiple 2D spritesA 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info See in Glossary. |
Use the 2D Sprite Editor to define multiple sprites from a single graphic image. In this case, each sprite defined in the Editor appears as a separate Sprite asset in the Project window. |
When a 3D file contains multiple animation timelines or multiple clips. | Unity automatically defines separate animation timelines or clips based on its animation import settings. The resulting multiple animation clipsAnimation data that can be used for animated characters or simple animations. It is a simple “unit” piece of motion, such as (one specific instance of) “Idle”, “Walk” or “Run”. More info See in Glossary appear as separate Animation Clip assets in the Project window. |
As well as the unique ID assigned to the asset, the .meta
files contain values for all the import settings you see in the InspectorA 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 a Texture, this includes the Texture Type, Wrap Mode, Filter Mode and Aniso LevelThe 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, those new settings are saved to the .meta
file accompanying the asset. Unity then re-imports the asset according to your updated settings, and then updates the corresponding imported “game-ready” data in the project’s Library
folder.
When backing up a project, or adding a project to a version control repository, include the main Unity project folder, containing both the Assets
and ProjectSettings
folders. Unity relies on the information in these folders in order to reimport your assets and reconstruct your game or application. Don’t back up the Library
and Temp
folders or put them under version control.