ExportOBJ

From Unify Community Wiki
Revision as of 23:06, 8 June 2010 by DaveA (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

C# - ExportOBJ.cs

<csharp> using UnityEngine; using UnityEditor; using System.Collections;

public class ObjExporter : ScriptableObject {

       private static Vector3 position;
       private static Quaternion rotation;
       private static Vector3 scale;
       private static string myName;
  
   [MenuItem ("File/Export/Wavefront OBJ")]
   static void DoExport()
   {

string meshName = Selection.gameObjects[0].name;

       string fileName = EditorUtility.SaveFilePanel("Export .obj file", "", meshName, "obj");

foreach (GameObject o in Selection.gameObjects) { MeshFilter mf = o.GetComponent(typeof(MeshFilter)) as MeshFilter; ObjExporterScript.MeshToFile(mf, fileName, false); }

   }

} </csharp>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox