[edit for clarification] I am not trying to import blend files into unity. As per my list of steps I'm taking, my last step was to export FBX. This is what I am using, not the blender file itself :) [/end edit]
I've done searching for this in google and here for a while now and everyone seems to say the same things, that the texture has to be saved separately in blender and placed into the material manually in unity. As well, most posts I find are for older version of unity or blender.
Now, I know I can import a model made in Blender with textures/materials intact w/o having to save a separate image. How do I know? I've done it twice, somehow. I don't know exactly what I've done that made it work. But, generally, I can't reproduce this, and it's frustrating. I'm looking for help from someone using the current version of blender (2.78) and unity (5.5 in my case), that also knows the correct steps to make this happen.
Here's what I'm doing :
Make model in blender.
Add new Material to the object (w/ object selected, in Properties->material - assuming one hasn't already been assigned)
Add new Texture to the object (Properties->texture, click on empty slot, click new, then under image mapping->coordinates: UV)
In edit mode, mark appropriate edges as seams
In UV/image edit pane, make new texture
Select all of model, then UVUnwrap
In UV/image edit pane, go to paint mode and paint texture
Under UVs, pack as PNG.
Back in properties->textures, under the Image section, I click the browse image to be linked, and select my newly painted texture.
Export to FBX.
After import in unity, no texture :( I really don't know what I did those two times I got it to work. I've been trying for about a month to get this to work again, where I can reproduce it, and no go.
Hi @AnOrdinarySandwitch, packing textures is saving texture to blend file, not to exported file.
Hi Kamil! Thanks for the comment :) I know that packing saves the image in the blend file, what I'm looking for is retaining it in the exported fbx.
I see lots and lots of older posts that say oh you can't there's no way but I beg to differ as I have somehow managed to do it twice! :) And if it can't be done at all as those posts suggest, then Maya couldn't do it either. As well, in Unity, I can preview fbx imports that show their textures, while others don't.
Oh, and there's no 't' in my name :)
Sorry for T :D
From my experience I can say you just saved image in your asset folder when it was working.
Answer by AnOrdinarySandwich
I've been thinking, trying to remember everything I did and tried when I got it to work with an FBX. I don't recall saving out the image file, but I can't say definitely I didn't either.
I hate to admit defeat when I've been so sure it was possible! lol But at least not having to manually assign textures to albedo's for every model import is a step in the right direction.
Thanks, Zilppuri, I'll contemplate this and see if I can't find my old project files for comparison.
Answer by Zilppuri
You can't embed image data in .blend file and import it to Unity.
You can have a Texture/Material name in a .blend file that corresponds to a image file in a subfolder. Unity will automatically create a material with the Texture/Material name in the .blend and create .mat files to match. If a corresponding image file is found, it will also auto assign that.
So: 1. Unity searches for a .mat file with matching name as .blend files texture/material 2. If no .mat file is found, it creates one. If image matching the material/texture is found, it is used when creating this material
So if you simply match your texture/material names and have the image files in correct folders (or adjust the import settings), then the textures will be retained.
What you might have done, is exported an fbx file, where the correct images have been exported to filename.fbm folder, where Unity could have looked them up when creating the necessary material files.
@Zilppuri & @Kamil1064,
Through my current research, I came across a post about this topic from around 2011 (sorry, I can't find that post anymore) where someone much later casually commented (in 2014) that FBX added embedded media support into the file itself. To support this, according to this older version of blender's fbx export documentation, the fbx format does indeed store texture data in it, as well as material<->texture connection. Additionally, from the video link I posted in a comment above, Maya can do this as well. And, user David in this blender stack exchange post answers a slightly different question by saying the fbx exporter packs textures used by the model, indicating that yes FBX files exported from blender can include not just materials, but textures as well. And one more bit of evidence that FBX can include textures that get imported in another program/engine, this older post from 2014 about FBX importing into Unreal Development Kit (Unreal 3 Engine), Mitchell Stokes says "Just confirming that the Embed Texture option works with packed textures " (in regards to exported FBX from blender into UDK with textures intact).
So, where lies the issue? Has blender's modern version of export FBX broken the embed media? Does Unity just not understand the embedded media? Is it embedding the wrong format of texture? I still say it should work, based on all this!
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
151 People are following this question.
Importing Blender FBX into Unity (pictures)
Material not shown on imported FBX sphere
texture not applied, despite many attempts
Texturing blender models in Unity
Unity Partially Ignoring Blender Animation