I downloaded the Space Kit from Kenney's assets and imported it to my project. I saw a subfolder called Models, with many files with .fbx extension (e.g. "alien.fbx", "astronaut.fbx", etc.). When I dragged them into the scene, I saw objects with some sub-objects (e.g. alien object with head and legs as sub-objects), but they seem just static objects - they have only renderers. Is this what these .fbx files are all about? Or maybe I am using these assets incorrectly?
2 Answers
The use of FBX files in Unity is the same as the use of FBX files anywhere else. Searching for FBX leads you to sites like this one that explain it in detail:
The Autodesk FBX file format is a popular 3D data interchange format utilized between 3D editors and game engines. It was originally created as the native file format for Kaydara’s Filmbox motion capture tool.
...
FBX supports 3D models, scene hierarchy, materials lighting, animations, bones, skinning as well as blend shapes.
(So don't discount your ability to find your own answers with a simple search!)
As you can see, this is a format commonly used to store 3D meshes, like the ones used by the MeshFilter/MeshRenderer components in Unity to draw 3D characters.
If you drag just the FBX file containing the mesh into your scene, then Unity knows only the mesh you want to use. It doesn't know what gameplay scripts or physics shapes etc. you might want to use with it, so by default it just creates a game object with a MeshRenderer to draw that mesh. You can add your own additional components to it to customize it further.
Alternatively, asset packs like those from Kenney will often contain both the raw FBX asset that stores the mesh and a Unity prefab file that represents an already-configured game object, with the mesh and other relevant components/materials/etc. attached. You still need to keep the FBX file in your Assets folder hierarchy in this case (the prefab references it to get its mesh), but for setting up your scene you'll more often want to use the prefab that's packaged it up for you already.
-
\$\begingroup\$ Thanks. I actually read about FBX files in general, but did not understand the relation between FBX and Unity's prefabs. Your answer makes it much clearer: a prefab (usually) uses the FBX file and adds more components on top of it. \$\endgroup\$ Commented Apr 25, 2020 at 18:37
FBX is indeed a file format for 3d models. Besides mesh data and materials it can also contain an animation rig and animation sequences for that rig.
However, the models from this asset pack do not seem to contain an animation rig. So if you want to animate them, you have two options:
- Import the models into a 3d animation program of your choice and add a rig to them
- Animate them in Unity by adding an Animator component to the root object, creating an animation controller and creating animation clips which manipulate positions and rotations of the sub-objects.