Search Unity

Exporting Tree Meshes

Discussion in 'Wish List' started by mokiloke, Sep 23, 2010.

  1. mokiloke

    mokiloke

    Joined:
    Jun 27, 2010
    Posts:
    5
    I have just started using Unity 3.0 beta and really liked the tree editor. However, i think it would be great if I could export the mesh I create in Unity to FBX or obj so I can open and exchange tree models back to 3dsmax.

    Is this possible or planned in future.

    Thanks

    Brodie
     
  2. br0kenp0ly

    br0kenp0ly

    Joined:
    Jun 3, 2008
    Posts:
    481
  3. mokiloke

    mokiloke

    Joined:
    Jun 27, 2010
    Posts:
    5
    I tried the script but it came up with this error

    Assets/EditorObjExporter.cs(80,57): warning CS0618: `UnityEditor.EditorUtility.GetAssetPath(UnityEngine.Object)' is obsolete: `Use AssetDatabase.GetAssetPath'


    Im a bit of a noob so I may have put it in the wrong place. I tried putting the script here
    C:\Program Files (x86)\Unity\Editor

    Also, should CUSTOM then come up on the main toolbar?

    THanks
     
  4. mokiloke

    mokiloke

    Joined:
    Jun 27, 2010
    Posts:
    5
    I have replaced UnityEditor.EditorUtility.GetAssetPath with Use AssetDatabase.GetAssetPath to no avail. Any suggestions.

    Cheers

    Brodie
     
  5. mokiloke

    mokiloke

    Joined:
    Jun 27, 2010
    Posts:
    5
    Is this something i should post in the scripting forum
     
  6. dakkon

    dakkon

    Joined:
    Oct 26, 2009
    Posts:
    2
    Hey Mokiloke, I don't know if you already found a solution for your problem if not here you go:

    "Assets/EditorObjExporter.cs(80,57): warning CS0618: `UnityEditor.EditorUtility.GetAssetPath(UnityEngin e.Object)' is obsolete: `Use AssetDatabase.GetAssetPath'"

    To fix it you just need to find line 80 on the script and change the EditorUtility to AssetDatabase; as you can see below; this should fix your problem and you will be able to export your tree meshes!! I did that and got them on my 3D application for tweaking!! ;) I'm not 100% sure if this is the right way to fix this or it only bypass that line of code; I'm an artist not a programmer but this trick works as I'm already using it!! Guarantee!! Once the script is working you should find the "export obj options" on the main bar on the "Custom" menu!

    if (mats[material].mainTexture)
    objMaterial.textureName = AssetDatabase.GetAssetPath(mats[material].mainTexture);
     
  7. Pockie

    Pockie

    Joined:
    Jan 21, 2011
    Posts:
    1
    Hi,

    I have a similar problem. I tried to export the BigTree example but i get the error "IndexOutOfRangeException: Array index is out of range". In the Export folder is an obj file with a size of 1kb. But it don't work with 3dsmax, cinema4d, microstation or sketchup.

    What have I as c# noob to do?

    I tried dakkons suggestion. If I change the line 80 the custom toolbar disappears.

    Thanks
    Pockie
     
  8. obefa

    obefa

    Joined:
    Jan 5, 2008
    Posts:
    37
    hi,

    i've got the same error as Pockie "IndexOutOfRangeException: Array index is out of range", trying to export the Big Tree example.
    In the Wiki, there are two files : ObjExporter.cs and EditorObjExporter.cs. I put the second one in the Editor Folder and i have the sub-menu "custom/Export" but what about the first file ?

    Thanks
    Fab
     
  9. obefa

    obefa

    Joined:
    Jan 5, 2008
    Posts:
    37
    Nobody can explain us how to do it..? :/
     
  10. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    the complete error is,

    so check whats happening in line 68..

    line 68:
    Code (csharp):
    1. sb.Append("usemtl ").Append(mats[material].name).Append("\n");
    add this line before it:
    Code (csharp):
    1. Debug.Log ("material:"+mats[material].name);
    ..what happens?