Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved Separate mesh from FBX file?

Discussion in 'Editor & General Support' started by starvetor, Oct 21, 2021.

  1. starvetor

    starvetor

    Joined:
    Nov 6, 2018
    Posts:
    42
    I found a bunch of 3D card models that each had their own FBX file with a card back/front material and a plane mesh. I'm writing a script so that I can have just 1 prefab and switch out the card front material with a texture atlas. I don't need all those extra models and stuff so I just want the plane mesh so I can assign it to the mesh filter component of the single card prefab.
    upload_2021-10-21_20-33-31.png
    Is there a way to have only the plane mesh? Any help would be appreciated!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,108
    I'm not sure what the granularity of Unity's "asset plucking" is... I think if you have a giant FBX with a bunch of meshes in it and your game only refers to one mesh, I will guess that's the only thing Unity will bring into the final game.

    You could probably do a quick test of this by putting two meshes in an FBX, then making a cube primitive in the scene and replacing the MeshFilter's mesh reference with only ONE of the meshes in your FBX, building it and looking at the build report to see what got sucked in.
     
    starvetor likes this.
  3. starvetor

    starvetor

    Joined:
    Nov 6, 2018
    Posts:
    42
    I don't think I was very clear in my original question or I confused myself, but your reply put me on the right track. Turns out I can directly reference the materials in the .blend object, so no need for the prefab or having a standalone mesh. Cheers!
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,108
    You can do this but let me warn you, as I have been mixing Blender and Unity for nearly a decade now and while it is AWESOME, keep in mind that the connection is "sensitive" and entirely dependent on the names in Blender, nothing else.

    So if you make ANYTHING in Blender (and this goes for FBX too) and decide to rename it, all the linkages in Unity will break.

    For materials I find it is best to make a material in Unity and connect that in your scene or prefab, which immunizes you to material name changes in Blender.

    It does not however immunize you to changes in the mesh or GameObject names! Those will still break your links! Same goes if you reorganize the hierarchy in Blender.

    I find it best to put one object mesh per Blender file, maybe 2 or 3 if they are VERY tightly-related, and then create only ONE prefab out of that, and from then on everything uses that prefab. That way if you do change / rename, you only break that one prefab, you rebuild it, you're golden again.

    Finally I shall leave my standard blurb of Blender / Unity knowledges here for you to enjoy:

    Blender3D import FBX:

    https://forum.unity.com/threads/from-blender-to-unity-problem.1073381/#post-6925811

    The script that Unity uses:

    ./Hub/Editor/2020.2.1f1/Unity.app/Contents/Tools/Unity-BlenderToFBX.py


    More on fixing it:

    https://forum.unity.com/threads/all-my-mesh-folder-content-is-gone.1102144/#post-7094962

    Blender3D objects used as trees / detail in Unity3D terrain (See the second half of this response)

    https://forum.unity.com/threads/ter...trees-made-with-blender.1112119/#post-7155631

    https://forum.unity.com/threads/all...nging-parent-in-blender.1159283/#post-7442123
     
    starvetor likes this.
  5. starvetor

    starvetor

    Joined:
    Nov 6, 2018
    Posts:
    42
    Wow thanks for the writeup! This is very informative. I'll definitely take your advice.
     
    Kurt-Dekker likes this.