Asset
An Asset is any project resource in Unity — textures, models, audio, scripts, materials — stored under Assets/ and referenced by a unique GUID, not a file path.
Imagine...
Assets are the pantry of a kitchen. Before cooking (running the game), the chef (Unity Editor) gathers ingredients — vegetables (textures), spices (materials), recipes (scripts), background music (audio clips). Everything sits in the Assets pantry. You do not cook from raw files directly — you reference them; change the source ingredient and every dish using it updates.
The concept in detail
An Asset is any file under your project’s
Assets/ folder. On import, Unity creates a .meta file with a
GUID (globally unique id) — that is how GameObjects and scripts reference Assets without
depending on a fragile file path.
The Asset Database (AssetDatabase)
manages Assets in the Editor. Unity re-imports when files change. At runtime, load
dynamically with Resources.Load() or
Addressables.
Common Asset types: .png/.jpg
(Texture2D), .fbx/.obj (Mesh), .mp3/.wav (AudioClip),
.cs (MonoScript), .prefab (Prefab), .mat (Material),
.asset (ScriptableObject).
Import Settings: each Asset type has its own knobs — Texture Compression / Max Size; Audio Load Type (Decompress on Load / Streaming). Correct settings cut memory use and load time a lot.
Diagram: Asset categories
Textures
.png .jpg .tga .psd
Texture2D · RenderTexture
Audio
.mp3 .wav .ogg
AudioClip
Models
.fbx .obj .blend
Mesh · Avatar
Scripts
.cs
MonoScript
Materials
.mat .shader
Material · Shader
Data Assets
.prefab .asset .anim
Prefab · SO · AnimClip
Hands-on steps
Import an Asset into the project
Drag a file from Explorer/Finder into the Project window, or Assets → Import New Asset...
Configure Import Settings
Select the Asset → Inspector → tweak Compression, Max Size, Load Type… → Apply.
Reference via SerializeField
Drag the Asset from Project onto a [SerializeField] field in the Inspector.
Load on demand with Addressables
Mark the Asset Addressable, then Addressables.LoadAssetAsync<T>(key) when needed.
Keep folders tidy
Use clear paths: Assets/Art/Textures/, Assets/Scripts/… Avoid dumping files at the Assets root.
Interactive simulator
Press Import to add an Asset. Click it to inspect properties. Assign it to a SerializeField to reference by GUID.
📁 Assets/
No Assets yet — press "Import Asset"
Inspector
Select an Asset
SerializeField
Drop an Asset here...
—
GUID: —
Code example
BasicReference Assets via SerializeField and use them at runtime.
using UnityEngine;
public class WeaponController : MonoBehaviour
{
// Drag Assets from Project onto these fields in the Inspector
[SerializeField] private Sprite weaponIcon;
[SerializeField] private AudioClip shootSound;
[SerializeField] private GameObject bulletPrefab;
[SerializeField] private Material glowMaterial;
void Start()
{
// Use the assigned Asset — no runtime search needed
GetComponent<SpriteRenderer>().sprite = weaponIcon;
}
public void Shoot()
{
Instantiate(bulletPrefab, transform.position, transform.rotation);
AudioSource.PlayClipAtPoint(shootSound, transform.position);
}
}Code example
AdvancedLoad and cache Assets at runtime with Resources.Load.
using UnityEngine;
using System.Collections.Generic;
// Runtime asset manager — load by key, cache for reuse
public class AssetCache : MonoBehaviour
{
private static Dictionary<string, Object> _cache = new();
public static T Load<T>(string path) where T : Object
{
if (_cache.TryGetValue(path, out var cached))
return cached as T;
// Resources.Load looks under Assets/Resources/
T asset = Resources.Load<T>(path);
if (asset != null)
_cache[path] = asset;
else
Debug.LogWarning($"Asset not found: {path}");
return asset;
}
public static void Unload(string path)
{
if (_cache.TryGetValue(path, out var asset))
{
Resources.UnloadAsset(asset);
_cache.Remove(path);
}
}
}
// Usage:
// var tex = AssetCache.Load<Texture2D>("Textures/hero_sprite");📌 Quick recap
- ▸Every Asset has a GUID in its
.metafile — never delete that file casually - ▸
SerializeField= static reference;Resources.Load= dynamic load - ▸Import Settings (Compression, Max Size) directly affect build size
- ▸Prefer Addressables over Resources.Load for larger games
⚠️ Common mistakes
❌ Delete or ignore .meta files
GUIDs change → Scene/Prefab references become Missing
✅ Always commit .meta files to Git with the Asset
❌ Dump every Asset into Resources/
Everything under Resources is included in the build → bloated size
✅ Only put Assets you must load dynamically; prefer SerializeField otherwise