This is a question I’ve just kind of avoided asking because things have worked but I’ve never really understood why, now my folders are FAR too messy and things are going wrong and right and I don’t know why, so I figure I’ll ask as unity doesn’t really seem to have extensive documentation on the subject. When importing a model what EXACTLY happens, and what is required? Does it import the materials with the model, but then you have to import the textures for those materials seperately? Do the textures get imported automatically too? Do materials all get imported into one place? Will a material only reference a texture in the same folder as it? In short what do you need to do to import a fully textured model, and is it different with animations?
OK, a lot to be answered.
There are some changes that I’ve found in 3.4, but the official documentation can be found here.
In order to import a model in Unity you need to do several things:
- Your textures need to be imported in a “Textures” folder in your project in Unity. The Textures folder is something like the Resources folder. It is possible to have multiple folders with the same name of these folders and Unity will put all the files in these folders together so it creates some sort of pool. For objects (prefabs, materials, etc) that you want to instantiate through code, you need to have these objects in a Resources folder. For an automatic texture-material match for the models you want to import, you need to put your textures in a Textures folder.
- Your model needs to be somewhere in the Unity project (inside your main Assets folder) that you can locate it easily. Unity will then import all your materials and put them in a “Materials” folder next to the imported model. All the materials that have a texture that is inside a Unity “Textures” folder will be named as the texture and will be linked to that texture.
- Unity will generate a prefab that includes your imported model. Depending on what type of compression/file (Maya, MAX, FBX, Blender, etc) you can set several import settings, like if you want to generate colliders for your model, or how to import your animations attached to the imported model.
What we usually do for our modelling pipeline, is to create a folder for the specific model in one Assets/Resources folder (this is done in explorer, without Unity open). This folder is named appropriately so that we can find it easily. In this folder, we create a Textures folder and put all the textures there. Then we place our FBX model also in main folder of the model. When starting Unity, it loads in all textures and then the model, creating the Materials folder and the prefab in the designated folder. This way we have all information of one model in one place.
Hopes this helps!
Also, a lot of the time, the image may not be imported on certain objects occasionally due to a glitch or error. Either way this is easily bypassed by locating the TEXMAP Image (a psd map of the painted image on the model which alot of modeling programs allow you to export separately usually) and dragging and dropping it into the " Materials " folder that was created when your model was imported into unity. You can then click on defaultMAT located in that folder, select your TEXMAP Image and apply it, it will then be applied appropriate to the UV Map within unity and added to your Model. Now your Model will have the texture you originally created for it and you will be able to visually see it in unity as well.