• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Drennyn · Jun 19, 2011 at 03:44 AM · importblender

Fixed Blender 2.57 Import In Unity 3.3

Wanted to post what I had to do in order to allow Unity 3.3 to import from Blender 2.57. (Verified on OS X Snow Leopard 10.6.7, Blender 2.57, Unity 3.3.0f4)

I had to comment out some of the named parameters at the bottom of the following Unity python script:

 Mac OS X: /Applications/Unity/Unity.app/Contents/Tools/Unity-BlenderToFBX.py
 Windows:  \Program Files\Unity\Editor\Data\Tools\Unity-BlenderToFBX.py



 ...
 io_scene_fbx.export_fbx.save(FakeOp(), bpy.context, filepath=outfile,
     GLOBAL_MATRIX=mtx4_x90n,
 #    EXP_OBS_SELECTED=False,
 #    EXP_MESH=True,
 #    EXP_MESH_APPLY_MOD=True,
 #    EXP_ARMATURE=True,
 #    EXP_LAMP=False,
 #    EXP_CAMERA=False,
 #    EXP_EMPTY=True,
 #    EXP_IMAGE_COPY=False,
     ANIM_ENABLE=True,
     ANIM_OPTIMIZE=False,
     ANIM_OPTIMIZE_PRECISSION=6,
     ANIM_ACTION_ALL=True,
 #    BATCH_ENABLE=False,
 #    BATCH_GROUP=True,
 #    BATCH_FILE_PREFIX='',
     BATCH_OWN_DIR=False)
     # I don't think HQ normals are supported in the current exporter
 print("Finished blender to FBX conversion " + outfile)
 

There may be a better way to fix this, but this worked for me in a pinch. Prior to this "fix" I was seeing the following types of errors in Unity's console and editor log file:

 TypeError: save_single() got an unexpected keyword argument 'BATCH_FILE_PREFIX'
 Blender could not convert the .blend file to FBX file.
 You need to use Blender 2.45 or higher for direct Blender import to work.
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DaveA · Jun 19, 2011 at 05:11 AM 0
Share

Thanks man!

4 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by tonycoculuzzi · Jan 07, 2012 at 06:08 AM

As of Unity 3.5 (or at least the beta) Blender import has been fixed! :)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Waz · Jan 10, 2012 at 12:13 AM 0
Share

Yes, the scripts in the forum thread mentioned above are the 3.5 scripts, AIUI.

avatar image
1

Answer by Waz · Sep 02, 2011 at 10:04 PM

There is a forum thread for this where Paulius from Unity posts, and includes a fixed script.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bradmarxmoosepi · Jan 02, 2012 at 05:52 AM 0
Share

Used this once before, and had to look for it again after I updated to Unity 3.4.2. Works brilliantly.

avatar image
0

Answer by jpvasquez · Sep 02, 2011 at 07:33 PM

I had the same problem, but with Unity 3.4 and Blender 2.59.0. I'm on MacOS, but I believe the issues may be the same. There are varying arguments and cases defined in Unity-BlenderToFBX.py and where they eventually get handed off to a blender script called scripts/addons/io_scene_fbx/export_fbx.py (in a method called 'save_single').

Here is the relevant modified portion of Unity-BlenderToFBX.py, starting at line 53:

     ...
     io_scene_fbx.export_fbx.save(FakeOp(), bpy.context, filepath=outfile,
     global_matrix=mtx4_x90n,
     use_anim=True,
     use_anim_optimize=False,
     anim_optimize_precision=6,
     use_anim_action_all=True)
     # I don't think HQ normals are supported in the current exporter

     print("Finished blender to FBX conversion " + outfile)


I hope that helps.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
-1

Answer by PurpleHeartGames · Jun 19, 2011 at 03:07 PM

How would we use it? I'm a bit lost..

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Drennyn · Jun 20, 2011 at 12:34 AM 0
Share

Well, if you're having trouble w/Unity 3.3 being unable to import Blender 2.57 .blend files directly, make the modification noted in the original post to resolve the issue. This will save you from having to manually export .blend files to .fbx and import the .fbx into Unity–speeds up your workflow. It's nice to be able to double-click from Unity, edit/save and be done with it.

avatar image PurpleHeartGames · Jun 20, 2011 at 02:59 AM 0
Share

How exactly do I add the modification? Edit the Unity-BlenderToFBX.py script?

avatar image Drennyn · Jul 10, 2011 at 02:08 AM 0
Share

Yep. Edit the file in a text editor of your choosing. Add the # in front of the lines shown above to comment them out and allow the script to run w/o error.

avatar image tonycoculuzzi · Jul 11, 2011 at 01:38 PM 0
Share

When you say "Allow the scrip to run w/o error." do you mean that you actually need to run the python script before it will work?

avatar image Drennyn · Jul 20, 2011 at 05:34 AM 0
Share

I mean I commented out the lines shown above using the # which allows Unity to import .blend files directly (because it launches this Python script internally, and the script will no longer crap out). In the original posting you can see the error message Unity was logging as it was internally calling this script. Commenting out the above lines allowed Unity to run this script behind the scenes successfully. You needn't bother concerning yourself about it once fixed as it's all taken care of for you. You can double click a .blend file in Unity, edit in Blender, save in Blender, switch back to Unity and see your changed automatically picked up--just like any other file type supported by Unity.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do you import Blender water into unity 3D 3 Answers

Object Colliders 2 Answers

Bones not importing from Blender 1 Answer

How to fix generate lightmap uvs issue? 1 Answer

Multiple UVs from Blender (Problem) 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges