TriLib – Tutorial: Importing a model from within Unity editor

In this tutorial, we will cover the steps to load your model using TriLib within Unity Editor.

First, import TriLib package to your project,  you can check only the “TriLib” folder for this tutorial, as shown in the following image:

Important: After that, you have to save your changes and restart Unity editor before proceeding with the tutorial, as TriLib native plugins needs to be loaded.

To do so, click on “Ask to save changes and restart”. Otherwise, you will have to restart Unity editor manually.

After the restart, TriLib will scan your “Assets” folder looking for files it can import, everytime a file is found, a prefab with the same name is created.

Note: For files that both Unity editor and TriLib can load (FBX files, for example), Unity native importer will be used.

To configure importing options, click on the original file under the Assets explorer.

Your asset inspector will look like this:

Here you can setup your model with various options, we will cover them here:

  • General Tab
    • Post Processor Options: Please refer to this link.
  • Meshes Tab
    • Scale: Use this field to override object scale.
    • Rotation Angles: Use this field to override object rotation angles.
    • Generate Mesh Colliders: Turn on this field to enable mesh collider generation (only valid for skinned meshes).
    • Convex Mesh Colliders: Turn on this field to indicate that generated mesh colliders will be convex.
  • Materials Tab
    • Dont Load Materials: Turn on this field to disable animations loading.
    • Textures Path Override: Use this field to override the object textures searching path.
    • Materials Override: Use this field to override materials with your own. If this array is not empty, each mesh material will be replaced by the material with the same index from this array.
  • Animations Tab
    • Dont Load Animations: Turn on this field to disable animations loading.
    • Auto Play Animations: Turn on this field to automatically play the first loaded animation (only for legacy animations).
    • Animation Wrap Mode: Use this field to change default animations wrap mode.
    • Use Legacy Animations: Turn on this field to use legacy Unity Animation component.
    • Animator Controller: If you don´t wish to use legacy animations, use this field to specify a Unity Animation Controller.

If your options are okay, you can simply drag your created prefab to the scene, or instantiate it via code later.