예제 #1
0
        public static string ExportGameObject(GameObject gameObj, bool copyMaterials, bool copyTextures, string oldPath = null)
        {
            if (gameObj == null)
            {
                //EditorUtility.DisplayDialog("Object is null", "Please select any GameObject to Export to FBX", "Okay");
                Debug.Log("Please add a Mechanical Keyboard first to Export to FBX.");
                return(null);
            }

            //string newPath = GetNewPath(gameObj, oldPath);
            string newPath = "Assets/Save Data/" + gameObj.name + ".fbx";

            if (newPath != null && newPath.Length != 0)
            {
                bool isSuccess = FBXExporter.ExportGameObjToFBX(gameObj, newPath, copyMaterials, copyTextures);

                if (isSuccess)
                {
                    return(newPath);
                }
                else
                {
                    //EditorUtility.DisplayDialog("Warning", "The extension probably wasn't an FBX file, could not export.", "Okay");
                    Debug.LogError("Could not export because the extension probably wasn't a FBX file.");
                }
            }
            return(null);
        }
예제 #2
0
        public static string ExportGameObject(GameObject gameObj, bool copyMaterials, bool copyTextures, string oldPath = null)
        {
            if (gameObj == null)
            {
                EditorUtility.DisplayDialog("Object is null", "Please select any GameObject to Export to FBX", "Okay");
                return(null);
            }

            string newPath = GetNewPath(gameObj, oldPath);

            if (newPath != null && newPath.Length != 0)
            {
                bool isSuccess = FBXExporter.ExportGameObjToFBX(gameObj, newPath, copyMaterials, copyTextures);

                if (isSuccess)
                {
                    return(newPath);
                }
                else
                {
                    EditorUtility.DisplayDialog("Warning", "The extension probably wasn't an FBX file, could not export.", "Okay");
                }
            }
            return(null);
        }