Table of Contents

Meta Files

Unity uses .meta files for each asset you add to a project. These contain a GUID (unique identifier) and additional information about _how_ an asset should be imported, e.g. max texture size, compression settings, … everything you change in the importer. All the information required to reconstruct the Library representation of an asset is stored in the meta file.

Note: please make a commit / have a backup before attempting any .meta file magic.

Swapping out a PNG file for a PSD

or: how to replace a file without having to rewire everything

Say you have added a PNG file to your project and used it in a dozen places. Later, you realize that you actually need more control and want to “upgrade” to a PSD file. Usually you would have to

But, with a bit of .meta file magic, you can replace the file directly and keep all references . Note: do not focus Unity during this procedure, otherwise .meta files will be created where you don't want them.

That's it - the image is replaced everywhere it's been used and now points to the PSD file. This works because

This also works for e.g. swapping out an OBJ file with a matching FBX, etc.

Swapping out a Prefab with another one

This is a bit more involved and will only work in specific cases. _Prefabs_ in Unity have both a guid (which identifies the prefab) and a ton of fileIds. Every object (GameObjects, Transforms, Colliders, …) have their own fileId. Assets in the scene are always referenced with (guid+fileId) so that there's a clear link.

So, when you want to replace a prefab, you have to

Swapping out High-Quality and Low-Quality Versions of an Asset

or: a real-world example why you would even want to do the above:

When you're careful and have defined a “Prefab Interface” as outlined above (matching GUIDs and root transform fileId between objects), you can use this for something very powerful: You can switch out all your high-resolution project assets for low-resolution project assets.

Example: Swapping Desktop-quality assets with 100.000 vertices ↔ Mobile-quality assets with 5.000 vertices.

Note that these can have different meshes, different textures, … all that matters is that they're “dumb”, that is, are only placed in a scene and not have further overrides / modifications / links.

A good way to do the above is to have two Packages, com.me.high-quality and com.me.low-quality that contain the same prefab interfaces and otherwise all the meshes/textures required.