public static void SaveGameObjectAsFBX(GameObject go, string fileName)
        {
            if (!isInitialized)
            {
                Initialize();
            }
            FbxExporter.ExportOptions options = FbxExporter.ExportOptions.defaultValue;
            /// Make sure it is in meter.
            options.scale_factor = 100f;
            FbxExporter exporter = new FbxExporter(options);

            exporter.CreateScene(fileName);
            exporter.AddNode(go);
            var ret = exporter.Write(FBX_PATH + fileName + ".fbx", FbxExporter.Format.FbxBinary);

            exporter.Release();
        }
Exemple #2
0
    private bool DoExport(string path, GameObject[] objects, FbxExporter.Format format)
    {
        _save_mode = FbxExporter.ExportOptions.defaultValue;
        _exporter  = new FbxExporter(_save_mode);
        _exporter.CreateScene(System.IO.Path.GetFileName(path));

        foreach (var obj in objects)
        {
            _exporter.AddNode(obj);
        }

        if (_exporter.WriteAsync(path, format))
        {
            Debug.Log("Export started: " + path);
            return(true);
        }
        else
        {
            Debug.Log("Export failed: " + path);
            return(false);
        }
    }