Importing a model
- Game Development course
- Intermediate
- Lesson 4/83
- 4 min
Learn to import a .fbx model into the project and make a prefab.
Importing 3D Models (.fbx)
3D models created in external programs like Blender, Maya, or 3ds Max are typically exported to Unity in .fbx or .obj format. When dragged into the project's Assets folder, Unity automatically imports the model. Selecting the model displays geometry, rig, and material settings in the Inspector.
// Model file is placed inside the Assets folder:
// Assets/Models/Character.fbxCreating Prefabs from Models
An imported 3D model can be dragged directly into the scene. However, to customize its components, attach scripts, and reuse it multiple times in the game, the scene object is dragged back into the Assets folder to become a Prefab. This allows all adjustments to propagate across instances from the template.
// Dragging the scene object into the Assets folder
// creates a reusable .prefab template object.Practice Model Loading Check
If the modelDosyasi variable satisfies the condition .EndsWith(".fbx"), print Debug.Log("Model yuklendi: " + modelDosyasi);.
Starter code
using System;
public static class Debug
{
public static void Log(object message) => Console.WriteLine(message);
}
public class Program
{
public static void Main()
{
string modelDosyasi = "Hero.fbx";
// Dosya uzantisini kontrol et ve yukleme mesajini yazdir
}
}Sample solution
using System;
public static class Debug
{
public static void Log(object message) => Console.WriteLine(message);
}
public class Program
{
public static void Main()
{
string modelDosyasi = "Hero.fbx";
if (modelDosyasi.EndsWith(".fbx"))
{
Debug.Log("Model yuklendi: " + modelDosyasi);
}
}
}Expected output
Model yuklendi: Hero.fbx
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which file format is the industry standard most commonly preferred for importing models and animations into Unity?
- .mp3
- .txt
- .fbx Correct answer
- .png
Explanation: The .fbx format is the most widespread because it carries 3D geometry, bone structures, and animation data in a single file.
2 Model File Extension
string modelYolu = "Assets/Models/Karakter.____";
string modelYolu = "Assets/Models/Karakter.fbx";
Explanation: The standard import extension for 3D models is the .fbx file.
3 Asset and Import Terminology
| Term | Meaning |
|---|---|
.fbx |
3D format with geometry and animation |
Import |
Bringing external files into the project |
Prefab |
Reusable GameObject template |
Inspector |
Model scale and import settings |