Search code examples
unity-game-enginefbx

How to save assets as fbx in Unity3d?


I generate model buildings dynamically in Unity3d. After they are generated I have lots of Meshes in the Scene. How do I save it as a .fbx file?


Solution

  • There is this plugin that may help you: https://www.assetstore.unity3d.com/en/#!/content/37276

    If you just need to save your models for further use, however, the simplest way to do it is to save them with Unity own format using AssetDatabase.CreateAsset from UnityEditor package, like this:

    using UnityEngine;
    using UnityEditor;
    
    [RequireComponent(typeof(MeshFilter))]
    public class Example : MonoBehaviour
    {
        private void Start()
        {
            AssetDatabase.CreateAsset(GetComponent<MeshFilter>().mesh, "Assets/mesh.asset");
        }
    }
    

    Or you can use this free plugin to export OBJ: https://www.assetstore.unity3d.com/en/#!/content/15862