Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Any cons to keeping models as blend files?

Discussion in 'Editor & General Support' started by TzuriTeshuba, Oct 7, 2022.

  1. TzuriTeshuba

    TzuriTeshuba

    Joined:
    Aug 6, 2019
    Posts:
    185
    So I have been using my blend files in my project as it is super comfortable to bypass the export/import phase and simply see my changes from Blender reflect immediately in Unity. It is a no-brainer that this is ideal for the development phase.

    My question is if there are any reasons to not leave them as blend files for final builds that I plan to ship?

    I plan to be updating the project after release and it would be comfortable to keep them as blend files if it does not incur any serious costs.

    Thank you!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
    I can answer your question precisely. I freakin' HATE fiddling and clicking with FBX export, etc.

    Keeping files ONLY as Blender files is awesome, one of the most endearing simplifying things about Unity with Blender.

    But as you intuit above, there are potential hidden costs. Here are the two major costs.

    Cost #1: every place you wish to build this will REQUIRE Blender be installed. Your computer? Fine! Install it! Your friend's computer? Eh, maybe you can entice him into installing it. Now... Unity's cloud build? Not so much. In fact, you will never see Blender installed by anybody offering cloud build / SaaS type services for the simple reason that it falls outside of Blender's licensing.

    Cost #2: you become beholden to changes in: Blender export behaviour, or Unity export script. The former is relatively stable, but does change from time to time. The latter can also change, such as around about 2018 or so Unity changed their python export script to suddenly include Camera and Light models by default. This broke all previous imported models, which ignored Camera / Light. If you failed to remove the Light/Camera from your scene, now your hierarchy moves around, you have an extra Camera and Light, and if you made prefabs from the mesh, those are broken now.

    I have elected to keep using Blender, but I have introduced a wart into my development process: every time I install a new version of Unity3D I go into the Python export script that it installs and I hack it to NOT import Camera/Light, since there will NEVER be a time that I want a Blender Camera in my scene.

    That change Unity made in the import script to make it start importing Camera and Light was really in my opinion completely useless to 99.9% of simple model-and-import workflows. The only possible place for such a feature might be for importing a huge complete scene with lights and cameras, and even that is useless since everything will need to be tweaked in Unity anyway!

    Here's some more of my mad high scribblings about this:

    Unity imports Blender3D objects as FBX via a little Python script:

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

    The Python script that Unity uses (substitute your Unity version number or search) to import:

    ./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

    Probuilder and Probuilderize and Blender:

    https://forum.unity.com/threads/probuilder-vs-blender.462719/#post-8060462

    Some more potentially-useful info:

    https://forum.unity.com/threads/orientation-problem.1265834/#post-8037734
     
    Last edited: Jan 9, 2024
    DevDunk and TzuriTeshuba like this.
  3. TzuriTeshuba

    TzuriTeshuba

    Joined:
    Aug 6, 2019
    Posts:
    185
    Wow, really thanks for such a wholesome answer! Just to clarify, Blender needs to be installed on the device performing the build (and not the device running the build)? I would assume yes, as nothing has broken when building for android and running on my Oculus Quest 2 (and I never installed blender on my Quest). Really thanks, I was mainly asking about performance costs (which you answered as well - just the one time overhead of converting to fbx), but you shed light on what I wouldnt have thought to ask.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
    Blender must be installed anytime Unity says "I gotta import this!"

    Those times would guaranteed be:

    - the first time it sees the file on a given platform (Win, Mac, iOS, Android, WebGL, etc)

    - whenever you switch platforms

    - whenever the file updates

    - possibly at build time? But maybe not... depends if Unity reimports everything. Technically if you import it and then uninstall Blender and then build it for the same platform, it might not need Blender at that precise moment.

    But yeah, I treat it as "needed always" for my games. As you noted, the .blend -> Unity workflow is just too effortlessly beautiful, The Way It Ought To Be Always(tm).

    Yeah, once it's imported then it is just bags of data: vertices, triangles, UVs, meshes, materials, etc.

    If you feel like getting cozy with procedural generation, Unity is super easy to do it in and I have an open source project named MakeGeo with a ton of random examples of code that just generates geometry "live."

    MakeGeo is presently hosted at these locations:

    https://bitbucket.org/kurtdekker/makegeo

    https://github.com/kurtdekker/makegeo

    https://gitlab.com/kurtdekker/makegeo

    https://sourceforge.net/p/makegeo
     
    TzuriTeshuba likes this.
  5. TzuriTeshuba

    TzuriTeshuba

    Joined:
    Aug 6, 2019
    Posts:
    185
    You the man, really appreciate it. Ill def check out your procedural generation project when we finish this crunch. I am interested in procedural generation and enjoy expanding the Procedural Primitives asset I bought a while back when I need to.

    One last question. Do you completely remove the blend file from the project directory when shipping, or is it enough to simply remove references / instatiations / useages of the blend files in the game scene / code?

    Cheers mate
     
    Kurt-Dekker likes this.
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
    Not necessary at all... Unity digests that into just a raw blob of data that it can use at runtime. That data may vary from platform to platform, but bears only a descendent relationship to your original Blender file.

    Remember how Unity includes stuff: everything referenced by anything in a build-included scene, PLUS everything located under any Resources/ folder, PLUS everything in streaming assets, plus all non-editor code (compiled).
     
    TzuriTeshuba likes this.