Search Unity

Question Platform change breaks 3D model (.blend) import settings

Discussion in 'Asset Importing & Exporting' started by BTStone, Oct 22, 2021.

  1. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Hey support,

    using Unity 2019.4.31f1

    I'm porting a small 3D project from another dev to other platforms. When I change the platform from PC to anything else (WebGL, PS4, Nintendo Switch, Xbox) ALL 3D models are broken.
    The models are .blend files. Since I'm "just" a programmer I had a tough time to figure out what happened and how to fix it. I booted up an original backup and compared assets/files:


    This is how the level is supposed to look like:

    Level_Working.png

    That Level is apparently a whole GameObject:

    Gameobject_Scene_Working.png


    This is how it looks after the platform change:

    Level_NotWorking.png

    That's how the GameObject looks like after the platform change:
    GameObject_Scene_NotWorking.png

    Now I compared the actual blend files and apparently the blend file itself and its import settings get overwritten/broken.

    And here's the nasty part: I can't revert that. My project sits in a git repo with git lfs and all assets are checked in and I'm not ignoring any asset related files.
    But when the platform change happens, the import settings clearly get changed. This implies the meta files have been changed, but looking into my repo, the meta files don't get updated/changed, which feels very scary. This means the overwriting of the meta files is irreversible.
    Only one meta file of a blend file gets changed, and if I revert that, nothing changes.

    As a sanity check I double checked the ProjectSettings:
    I noticed that the OG working version had the Version Control Mode set to "Hidden Meta Files" and the Asset Serialization was set to "Mixed".
    I coped the OG backup and made a new repo.There I changed the settings to "Visible Meta Files" and "Force Text". Then I made a commit of all assets.
    After that I changed the platform again to something different. Everything broke again. And once again only one meta file of one blend filewas adjusted. And once again, when I revert that, nothing changes.

    From what I was told Unity uses Blender to import the .blend files which are in the Unity project into the FBX format. This means Blender needs to be installed on the system. Apparently something weird is happening with the Blender-Importer. Now here is what I tried to find a solution to this problem:

    - installed different Unity versions -> same result
    - installed the very same Blender version (asked OG dev) which was used for the creation of the blend files -> same result
    - installed different Blender versions in combination with different Unity versions -> same result
    - tried to do the platform change on another system, I have a Macbook here -> same result


    Now I was told that I could directly export the blend files as FBX. I tried that, but that led to a multitude of other problems (texture/materials and animation data are not exported/imported) and honestly, doing this for all models is quite tedious.


    I'm at a loss here. This feels like a nasty bug and is also very scary that I cant revert the re-import changes to the models.
     
  2. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Alright, I did some further investigation and I found numerous topics like these:

    https://forum.unity.com/threads/fix...-in-2019-2-0a13-unity-blendertofbx-py.667804/
    https://answers.unity.com/questions...d-not-convert-the-blend-file-to-fbx-fi-1.html

    And since it seemed to be linked to the .blend files and the way how the (re)import process works I thought, alright, let's give it a try and change
    the unity-blendertofbx.py file with what the people suggested in the topics

    Here is what I tried, and nothing worked:

    # Test A: With already broken project (Using the project I did a platform change once, so the reimport kicked in and broke the files) #

    1) Unity is closed
    2) Uninstalled my Blender version and installed Blender 2.79
    3) Made sure Blender 2.79 was associated with .blend files
    4) Swapped the unity-blendertofx.py file with the one people suggested to fix the problem in the Unity installation folder of the unity version I'm using for the project
    5) Opened the project -> Nothing changed but there was also no reimport happening on opening the project
    6) Did another platform change so the re-import kicks in
    7) Platform change done -> still everything broken


    # Test B: Duplicated the OG backup of the project #

    1) Unity is closed
    2) Opened the project -> Models look fine
    3) Platform change done -> Models broken


    At this point I kinda feel like maybe this is just a 2019.4.30f1 bug? Why not make another test and just upgrade to 2020.3. I mean, I did that before, and it still did not work, but the last time, I did not know about the .py file!

    # Test C: Upgrade another OG backup to 2020.3 #

    1) Unity is closed
    2) Swapped the unity-blendertofx.py file with the one people suggested to fix the problem in the Unity installation folder of the unity version I'm using for the project, this time 2020.3.15f2
    3) Opening the project and upgrading
    4) Models Already broken before I could init the platform change


    Yeah, this didn't go as expected :/


    And finally I did this:

    # Test D: Doing the same thing as in Test A, B and C - but before opening the Unity project deleting the whole library folder #

    This did also not work. Still broken models.


    If you have any suggestions what to do, I'm all ears. In the meantime I'll create a bugreport, because I honestly don't think this is supposed to be like this.