Hi there everybody!
Although I model an object in blender setting certain materials to be in a specific order, once imported in unity their succession change. The problem is that I need them to stay in that order.
I’ve seen an other answer on this forum about the same problem saying is all about the id sequence of faces. Ok, but what does id sequence of faces mean and how can I actually fix the thing?
4 Answers
4- Put the materials in the order you want
- In edit mode, select all vertices
- Press
W - Select
Sort Mesh Elements - Sort by
Material - Done!
Full details here:
And the Blender manual on sorting mesh elements here:
Here is what I did.
As you probably know, the trick @Gerontius told about doesn’t work anymore.
Let’s say we have an object with three faces and three materials.
- Go to edit mode, press
Pand separateBy Material. - Export the file (or just save it if you’re using
.blendfiles) and let Unity import the model. - Back to Blender, select the separated parts of the mesh, the object with the main material should be activated. Press
Ctrl+Jto join them. - Export the file (or just save it if you’re using
.blendfiles) and let Unity import the model.
and done. Hope this helps.
Thank you! But I should notice that before Ctrl+J you need to go to Object mode first. And if you dont get a result you wanted, try to change select order in step 3.
– unity_Ueq9NFBYVyDOTgThank you! This finally did the trick for me, with a two-material object that strangely one day imported the lower LOD version mesh of an .fbx with its material indices inverted in Unity.. I fixed it by separating the low LOD mesh by material in Blender, importing to Unity in broken pieces, then joining the pieces back in Blender (with top material mesh as active), then reimporting- and voila! Unity displays the correct material index order! Weird, but glad I got it working.
– LashesI think I found an easier solution: I did the same trick @Gerontius suggested, except I sort all elements, not just vertices. Shift+select all elements in the list. It worked for me.
– HenryCGSThe @Gerontius method works fine for me in Blender 3.3.1 but you must select faces. Materials are assigned to faces not points or edges. @makaka-org Select your mesh in Blender, go into edit mode (faces), select all the faces in the mesh, and now go to the menu Mesh-> Sort Elements... -> Material. @HenryCGS is talking about the list that appears at the bottom left of the screen (Vertices, Edges, Faces) which you can change at this point. I leave the faces option selected. And it should already be done once you click out of that Sort mesh Elements box.
– Darren-RBlender is just so freaking awesome!!
I know no other software that always has a fix, like Blender ![]()
When the seconds hand is moving along a real clock, the minutes hand realistically doesn't stay in place like in the Unity scene. It moves very subtly to the next minute. You will often see the minute hand between minutes as seconds go by. When the seconds hand finally reaches 60, THEN the minute hand is on the next minute. This also applies for hours in relation to minutes, days in relation to hours, etc.
– Czar-ManHmmm. This doesn’t work for me. I’m on Blender 2.79
Shouldn’t I see some changes in Blender instantly?
EDIT: This is no longer valid, look below ;) ---------------------- Hi Martin, Unity changed, I for one can no longer find any order in how things are imported, it's apparently not Blender, we've had to make scripts that deals with this, in Unity :/
– FritslAre Time.hour, Time.minute or Time.second giving you only whole numbers or numbers with values after the decimal? If the latter then use Mathf.Floor(Time.second) etc.
– mrpmorris
How do I know it sort successfully? I click "Mesh > Sort Elements... > Material" and I see "Sort Mesh Elements" pop up and I see nothing else ![BlenderSortMaterial][1] [1]: https://i.imgur.com/kYEeXbD.png
– NathanJSmithThis worked for me, thank you! There's no visual change in Blender but in Unity, the materials are assigned in the same order now. It's peculiar that the FBX exporter doesn't do this automatically.
– Darren-R