- Home /
texture not applied, despite many attempts
Hi,
how could i apply a texture on a mesh imported in .fbx from Blender?
I have tried many ways :
Set the texture in Blender, being in "Object Mode", with the "Texture" option ON, and export in .fbx
in Unity, add the texture in the "Textures" folder, add a mesh renderer to the imported mesh, drag and drop the texture on the mesh
export the .fbx with the same name as the .blend file, in the same folder where the texture is
in Unity, add the texture dynamically, with this code :
var myTexture : Texture;
function Start () { renderer.material.SetTexture("_MainTex", myTexture); }
and drag and drop the texture in the variable myTexture
restart Unity and see if anything works better... still not
Would you have any idea about this?
Thanks a lot
Answer by phfatmonkey · Feb 13, 2013 at 07:07 PM
You need to apply the texture to a material, then apply the material to your mesh. I export FBX from 3DS Max and it will sometimes bring a material in, but there's no textures applied to the material. I haven't found a way to wholly import a material created in my 3D package into Unity.
To create a material, right-click on your project pane where you want to save your material, and select Create > Material.
@Ryan Thanks Ryan, so i have a new material in the "$$anonymous$$aterials" folder, and a texture in the "Textures" folder. I drag and drop the texture to the square in the material area. Then i drag and drop the material to my mesh in Hierarchy.... and nothing is happening...
Strange....
Does the material component show up in the Inspector of your object?
This might seem like a dumb question but, are you looking at a Textured View of your scene?
Yes, i can see the small image of the texture when i click on the character, and the material has the good preview. The scene has other textured objects, and the Textured View is indeed selected. I switched off and on my computer, but still the same...
The only thing I can think of is your model doesn't have UV coordinates mapped in Blender. Here's a forum link that might help:
http://answers.unity3d.com/questions/124817/why-is-my-imported-fbx-file-not-showing-textures.html
I don't know why, but now it works.... no idea why, thanks to you guys anyway for your help!
Answer by Pauls · Feb 13, 2013 at 09:39 PM
I don't know why, but now it works.... no idea why, thanks to you guys anyway for your help!