- Home /
Ignoring certain objects on blender import
Hi! My .blend files all have extra objects in them like scaling references and lights and cameras for blender's renderer and such, which I really don't need or want in unity. Heck, I don't need it to import the high-poly meshes when doing normal baking either, but I don't want to remvove those from the file.
I'd like to make the blender importer drop any imported item that starts with a "." or something like that, so I can basically in blender mark things to be ignored by unity.
I'm fairly sure this can be achieved with the post-import scripting option but I really don't know what a good way to go about doing it is as i've barely started learning unity's APIs.
Thanks!
Select $$anonymous$$esh And Armature on EXPORT, deselect the other 3 entries in BLU$$anonymous$$
Anything Unity doesn't use can be safely deleted after Import.
Answer by StarWeaver · Jul 30, 2014 at 08:48 PM
After discovering that the scirpt unity uses to tell blender what to do is laying around in unity/editor/data/tools, I made this little hack to it to implement my own solution:
--- Unity-BlenderToFBX.py.orig 2014-05-13 01:03:46.000000000 -0700
+++ Unity-BlenderToFBX.py 2014-07-30 13:25:00.913891600 -0700
@@ -71,7 +71,12 @@
BATCH_OWN_DIR=False)
else:
# 2.59 and later
+ # WVR HACKUMS HERE
+ for obj in bpy.data.objects:
+ obj.select = False if obj.name[0] in '_.' else True
+
kwargs = io_scene_fbx.export_fbx.defaults_unity3d()
+ kwargs["use_selection"] = True
io_scene_fbx.export_fbx.save(FakeOp(), bpy.context, filepath=outfile, **kwargs)
# HQ normals are not supported in the current exporter
For Blender 2.80 use this:
for obj in bpy.data.objects:
if obj.name[0] == '_' or obj.name[0] == '.':
print("Ignoring: " + obj.name)
obj.select_set(False)
else:
print("Selecting: " + obj.name)
obj.select_set(True)
...
use_selection=True,
...
Answer by Xtro · Jun 25, 2014 at 04:22 PM
1) Never import blender (or maya, 3dsmax) files into Unity directly. Always import fbx files. Reasons : a) Unity actually can't import anything else than fbx b) Unity converts the blender file to fbx first, then imports it as fbx. c) Unity does this conversion via blender (or other apps). If you don't have blender installed on your pc, Unity can't import blender files anymore.
2) For Importing certain objects :
a) In Blender (or other apps) select the object you want to import into Unity. b) Export Selected Object as FBX via Blender File Menu. Actually I didn't use blender before but all 3D apps should have something called "Export Selected".
(in Blender there's a checkbox "Selected objects" when exporting to fbx)
Ok, I gave the 'import fbx files directly' a good try, and found it less than useful. The default exporter for blender can't put out a file with the right orientation despite having those axis options.
The other option, an exporter I found at http://blenderfbx.render.jp/home , handles the axises properly but lacks many features, including the ability to apply modifiers automatically on export.
Answer by marcospgp · Jun 01 at 01:33 PM
In Blender, you can move the objects you want to hide from Unity into a separate collection and disable that collection by unticking its checkbox.
You can then import the .blend file directly and the hidden objects won't show up in Unity.
Your answer
![](https://koobas.hobune.stream/wayback/20220613152449im_/https://answers.unity.com/themes/thub/images/avi.jpg)