0

I am working on exporting a specific game object as an fbx file through Unity.

I have succeeded in creating an fbx file for a single frame using the code below.

However, I have two questions regarding the construction of the desired code.

  1. After exporting to an FBX file, Unity automatically imports the FBX file, and infinite loading occurs during the process. Is there a way to prevent automatic importing?

  2. I want to save game object information from multiple frames by applying certain conditions and use the saved information to create an animated FBX file.

I would appreciate your feedback on the question.

using System.IO; using UnityEngine; using UnityEditor; using UnityEditor.Formats.Fbx.Exporter; using UnityEditor.AssetImporters; public class ExportFbx : MonoBehaviour { [MenuItem("Tools/Export Modify_origin_edit to FBX (Binary)")] public static void ExportFbxFile() { GameObject obj = GameObject.Find("Modify_origin_edit"); if (obj != null) { string filePath = Path.Combine(Application.dataPath, "FBX_file/MyObject.fbx"); string prefabPath = Path.Combine(Application.dataPath, "FBX_file/MyObject.prefab"); ConvertToPrefabVariantOptions convertSettings = new ConvertToPrefabVariantOptions { ExportFormat = ExportFormat.Binary }; GameObject prefabVariant = ConvertToNestedPrefab.ConvertToPrefabVariant(obj, fbxFullPath: filePath, prefabFullPath: prefabPath, convertOptions: convertSettings); Debug.Log("FBX ok: " + prefabPath); } else { Debug.LogError("error."); } } } 
1
  • string filePath = Path.Combine(Application.dataPath, "FBX_file/MyObject.fbx"); .. well, yes have you tried to not export to a location within your Unity project? You could e.g. trigger a docs.unity3d.com/6000.0/Documentation/ScriptReference/… Commented Jan 16 at 15:24

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.