[Addon] Unity Simple Export

Holy cow its been a long time since I posted here! I wrote an exporter addon people working with Unity might be interested in. Its meant to be ultra fast for simple static mesh assets. Your model comes into unity as a single mesh (with submaterials if needed) and 0, 0, 0 on all transforms (including rotation). It uses Empties to represent props, so you can export multiple assets from a single blender scene. I find this useful for sets of related props. It also supports Dupligroups (if any one uses those, I certainly do). I wrote it for my own production, but I figured someone else might find it useful.

https://youtu.be/xOxzLHf1D7g

I was too lazy to put it on the wiki. I hope a zip attachment is sufficient.

UnitySimpleExport_v1_4.zip (2.18 KB)

EDIT - I’ve stopped supporting this script, and removed the video showing how to use it. I’m leaving the file here if you want it, but use it at your own risk.

Danny

1 Like

Hi Orchidface,

Very nice add-on very useful. I have a remark, if I can, it’s not very difficult to add a popup menu to setup the URI to the assetfolder or a textbox in the tool panel to write the URI… I had yet make this kind of code here:
http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Cookbook/Code_snippets/Interface

Good Luck!
Spirou4D

nice work, but I have still some like this: 0 out of 0 props have exported

Ah that does look pretty strait forward. I’ll have to look into that.

You’ve made sure the empty is a cube type? In the tutorial I use plain axes but I changed the script to only look for cube empties now so that you can use other empty types for other things and not have it mess with the exporter.

@OrchidFace ok, now works fine :wink: thx!

Looks really useful. Needs a GUI element though. Maybe an “Export To Unity” panel in the Export tab, with a directory selector as @Spirou4D mentioned and a button. Or, preferably (to keep the UI consistent), an entry in the File > Export menu.

Argh - I’d really love this awesome Addon, @OrchidFace - it looks just like what I need to highly optimize my workflow.

However I keep getting permission errors - I presume it’s due to me being on OSX and the Unix OS behind is different / you being on Windows? Not sure, I’m not familiar with how this works, here’s my error message, any help would be highly appreciated, thank you very much :slight_smile:


Traceback (most recent call last):
File “/Users/fritslyneborg/Library/Application Support/Blender/2.74/scripts/addons/UnitySimpleExport_v1_2.py”, line 34, in execute
bpy.ops.wm.save_mainfile() #simply saves
File “/Applications/Blender/blender.app/Contents/MacOS/…/Resources/2.74/scripts/modules/bpy/ops.py”, line 189, in call
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Cannot open file untitled.blend@ for writing: Permission denied

location: <unknown location>:-1

Did you save the file as something first? Or is it a fresh unsaved untitled file?

First: Wow - I was certain I had double checked that – but you are right; I had not!

Second: Yaw! - When I do everything correct, just nothing happens! No message in the console, no file saved, it’s like I never started your script.

  • I have saved first (now - the reason I had not before must have been that I thought I did something wrong when I got no feedback, so I must have been irratic in my testing - sorry)

  • Everything has a material

  • I have also tried to leave the path as “”, and even “\” with the same result: Nothing saved next to the .blend file, and no mesage what so ever in the console.

  • I have uninstalled and installed and opened fres files as I’m trying not to look even more like a fool :wink: It appears - at least to me - that there’s just no feedback what so ever, no matter what - only if I am not saving first, I get the permission-error.

  • I have tried to mess about in other ways, to see if ‘anybody is there’ - and yes: All is responsive, look at something like this error message for example, provoked on purpose:


Traceback (most recent call last):
File “/Applications/Blender/blender.app/Contents/MacOS/…/Resources/2.74/scripts/modules/addon_utils.py”, line 306, in enable
mod = import(module_name)
File “/Users/fritslyneborg/Library/Application Support/Blender/2.74/scripts/addons/UnitySimpleExport_v1_2.py”, line 2
Path = “greencheese” # absolute path with a double backslash at the end. Blank quotes (“”) will dump into the current .blend path.
^
SyntaxError: invalid character in identifier


Thanks a lot - any help is highly appreciated, I feel I’m so close to a better workflow… :slight_smile:

I posted a newer version (v1_4) in the original post. You’re path is greencheese? Is that a valid path? Don’t you need a drive or something? Also use all double backslashes (I didn’t explain this in previous versions). If you want the file to dump into the same path as your .blend you can do blank quotes like “”. You might try that to debug if your path string is the issue.

Also make sure to use a cube empty. It wasn’t shown in the tutorial video because I added that later. I tried to include that in the video annotations. Additionally make sure your stuff is parented properly. To find more information toggle the system console in Window.

As people have mentioned I really need a UI for this addon and save the string into blender user preferences, but this feature wouldn’t save me any time and it would take me a long time to implement (because I’ve never done any GUI stuff with the blender API) so its hard for me to justify doing it when my game is pressing and my money is dwindling. I hope you can get it working let me know if “” as the path works.

Refresh the topic.

Hello all.
Does anyone have guide.
Video no longer works.

Sorry about this. I decided to stop supporting the script so I took down the video. I still use the script every day, but since so few people seemed to be interested in it, it didn’t seem worth it to maintain it.

Hi, i am in need of a script that exports multiple files from one blend file into many .blend/.fbx files. Im sure blender used to do this back in the day. Does your script maintain the position of the meshs that it is exporting ? if you are not sure do you mind if i take it and try and modify it ?