Search Unity

Question Nested prefabs for Blender imported models?

Discussion in 'Prefabs' started by dichtermut, Mar 23, 2023.

  1. dichtermut

    dichtermut

    Joined:
    Jul 21, 2018
    Posts:
    26
    I'm in the prototyping phase, so I'm creating some very simple models in Blender (not usingtextures for now). My doubt comes when I import the models from Unity, because I was using two approaches:

    Option A:
    For now I'm using the same .blender file directly in Unity (I see that it is mostly recommended to export the models in .fbx, but I haven't had the time to investigate why this is exactly). So, when I import a .blender file, it appears in Unity editor as this box with a black stripe on top, which I believe means that it is an imported mesh. When I drag this into a Prefab I already have (with other components), it organises itself as a sort nested prefab (considering that this blue box with a black stripe could be considered an imported Prefab, which I'm not sure it can).
    Anyway, in the inspector I see that only 2 components have been added: a MeshFilter and a MeshRenderer.

    upload_2023-3-23_14-39-19.png


    Option B:
    This happens when I drag into my original Prefab not the whole imported mesh box, but only the Cube element pointed below. In this case, the model is rotated, the material appears missing (which is OK since I will add a simple Material later from script depending on the player), but in turn, I also get a MeshCollider, which I was not getting with option A.

    upload_2023-3-23_14-41-38.png

    So my question are:

    1) When importing a Blender file, is it common to attach the model to an existing Prefab as its child as I do in Option A? Or do the Mesh components usually get attached to the Prefab object itself like in Option B?

    2) Is any of the 2 approaches I described above correct? I can see that both of them have something twisted, but I don't know which one is the one to correct.

    3) Also, is it really a bad idea to be using the .blender files directly instead of .fbx?
     
  2. howardmealor

    howardmealor

    Unity Technologies

    Joined:
    May 21, 2021
    Posts:
    18
    Hi @dichtermut,

    1) You can just drag your imported blend model into scene or hierarchy to instantiate it as a Prefab. For best import practice see https://docs.unity3d.com/Manual/ImportingModelFiles.html. Yes, the 'blue box with a black stripe' is the icon for an imported mesh. Whether you nest the model inside another prefab depends upon use case i.e. if you intend to treat the model as part of a larger Prefab object, as it seems you want to.

    2) Option A is the way to go unless your use case involves working with the mesh data directly e.g. procedural manipulation from script. For info about orientation and Blender -> Unity setup see: https://forum.unity.com/threads/orientation-problem.1265834/#post-8037734

    3) For some considerations regarding use of .blend files over .fbx see: https://forum.unity.com/threads/blend-vs-fbx.532563/
     
    dichtermut likes this.