Unity x Blender 3.0 Integration #95099

Closed
opened 2022-01-20 23:39:59 +01:00 by George Ing · 30 comments

System Information
Operating system: Windows
Graphics card: GTX 3080

Blender Version
3.0

Short description of error
Hey folks,

It's George from the Import Workflow team over at Unity.

We've started having users report that Blender 3.0 doesn't work nicely with Unity when it comes to native ".blend" files. In the case of ".blend" files in the Unity Engine we 'secretly' re-spin up a Blender instance on the '.blend' file (by selecting the Windows default program registered for .blend files) and trigger an FBX export under the hood., which we then import.

It seems like in Blender 3.0 the files are possibly now associated with the launcher, and that's causing the Unity Editor issues? We're not quite sure.

We'd love to hear any suggestions about what's changed in 3.0 that might have a knock-on anyhow; and perhaps chat with you about any better ways we can handle this problem space.

**System Information** Operating system: Windows Graphics card: GTX 3080 **Blender Version** 3.0 **Short description of error** Hey folks, It's George from the Import Workflow team over at Unity. We've started having users report that Blender 3.0 doesn't work nicely with Unity when it comes to native ".blend" files. In the case of ".blend" files in the Unity Engine we 'secretly' re-spin up a Blender instance on the '.blend' file (by selecting the Windows default program registered for .blend files) and trigger an FBX export under the hood., which we then import. It seems like in Blender 3.0 the files are possibly now associated with the launcher, and that's causing the Unity Editor issues? We're not quite sure. We'd love to hear any suggestions about what's changed in 3.0 that might have a knock-on anyhow; and perhaps chat with you about any better ways we can handle this problem space.
Author

Added subscriber: @George.Ing

Added subscriber: @George.Ing

Added subscriber: @George-Supreme

Added subscriber: @George-Supreme
Member

Added subscriber: @Harley

Added subscriber: @Harley
Member

Hey George,

Could you explain a bit more what "doesn't work nicely" and the "issues" are that are reported? Ie, an error occurs, no file is imported, it is incorrectly imported? Does this seem to affect all Blender 3.0 users or just some?

The launcher is indeed new, but if you were to start that it should start up the main blender executable, passing along any arguments that you use. I can imagine issues if you "open" the blend file with ShellExecute or ShellExecuteEx, instead of launching the program via CreateProcessA. Do you mind explaining more about how you launch blender and how you perform the export?

One concern about "selecting the Windows default program registered for .blend files" is that some users might have an older version of Blender associated with those files. This association is not done in all installation scenarios.

Hey George, Could you explain a bit more what "doesn't work nicely" and the "issues" are that are reported? Ie, an error occurs, no file is imported, it is incorrectly imported? Does this seem to affect all Blender 3.0 users or just some? The launcher is indeed new, but if you were to start that it should start up the main blender executable, passing along any arguments that you use. I can imagine issues if you "open" the blend file with ShellExecute or ShellExecuteEx, instead of launching the program via CreateProcessA. Do you mind explaining more about how you launch blender and how you perform the export? One concern about "selecting the Windows default program registered for .blend files" is that some users might have an older version of Blender associated with those files. This association is not done in all installation scenarios.

Added subscriber: @Garek

Added subscriber: @Garek

About launcher, it exists since 2.93 so if there is issues with launcher itself they should have been started from that time.

In #95099#1292228, @Harley wrote:
One concern about "selecting the Windows default program registered for .blend files" is that some users might have an older version of Blender associated with those files. This association is not done in all installation scenarios.

If that's the case then one possible issue I can imagine is that user have compression of .blend files enabled and older version of Blender associated as default program. In 3.0 Blender switched to zlib for compression:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Core
That files will not load in older versions, user will see message along the lines of "that's not a supported file format"

So if issues reported can be explained by default (old) Blender not being able to open .blend files you can test that by asking user to disable compression and re-save file.

About launcher, it exists since 2.93 so if there is issues with launcher itself they should have been started from that time. > In #95099#1292228, @Harley wrote: > One concern about "selecting the Windows default program registered for .blend files" is that some users might have an older version of Blender associated with those files. This association is not done in all installation scenarios. If that's the case then one possible issue I can imagine is that user have compression of .blend files enabled and older version of Blender associated as default program. In 3.0 Blender switched to zlib for compression: https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Core That files will not load in older versions, user will see message along the lines of "that's not a supported file format" So if issues reported can be explained by default (old) Blender not being able to open .blend files you can test that by asking user to disable compression and re-save file.
Member

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
Member

There's a few things that could cause you problems, like garek mentioned the compression format changed, loading a compressed 3.0 file into 2.93 will not work (the other way around is fine though, 3.0 will read 2.x compressed files), if the 2.93 version is still the "default blender", that could cause you issues with some files.

Also the launcher which does exist since 2.93 will make your life, "difficult" depending on how the unity integration was setup, the main difference between the launcher and the old blender process that you used to launch, is that if you are waiting for the process to exit as a sign the the FBX file is ready, this assumption is now invalid, the launcher exits as soon as it launches the actual blender process.

It's really hard to guess what exactly is causing you issues without some further diagnostics or more symptoms that you are seeing

If you want to have a chat, works for me, you can find me most days on blender.chat in the #blender-coders channel, I'm on mountain time (GMT-7) so depending on where you are some scheduling may be required.

There's a few things that could cause you problems, like garek mentioned the compression format changed, loading a compressed 3.0 file into 2.93 will not work (the other way around is fine though, 3.0 will read 2.x compressed files), if the 2.93 version is still the "default blender", that could cause you issues with some files. Also the launcher which does exist since 2.93 will make your life, "difficult" depending on how the unity integration was setup, the main difference between the launcher and the old blender process that you used to launch, is that if you are waiting for the process to exit as a sign the the FBX file is ready, this assumption is now invalid, the launcher exits as soon as it launches the actual blender process. It's really hard to guess what exactly is causing you issues without some further diagnostics or more symptoms that you are seeing If you want to have a chat, works for me, you can find me most days on blender.chat in the #blender-coders channel, I'm on mountain time (GMT-7) so depending on where you are some scheduling may be required.

Added subscriber: @EtienneArchambault_Unity

Added subscriber: @EtienneArchambault_Unity

Hey guys, thanks for the follow up!
I'm investigating this case with George and the team.
You can find a clean description with this report : https://issuetracker.unity3d.com/issues/blender-could-not-convert-the-blend-file-to-fbx-file-error-is-thrown-when-blend-file-is-imported
I can add that if you never installed Blender 3.0 before, upon installing it re-importing .blend will always fail in Unity. I tested on VMs and it's 100%.

About the blender-launcher.exe, I dont see it in the 2.93 root folder. Was it somewhere else in that version?
image.png
Cheers

Hey guys, thanks for the follow up! I'm investigating this case with George and the team. You can find a clean description with this report : https://issuetracker.unity3d.com/issues/blender-could-not-convert-the-blend-file-to-fbx-file-error-is-thrown-when-blend-file-is-imported I can add that if you never installed Blender 3.0 before, upon installing it re-importing .blend will always fail in Unity. I tested on VMs and it's 100%. About the blender-launcher.exe, I dont see it in the 2.93 root folder. Was it somewhere else in that version? ![image.png](https://archive.blender.org/developer/F12814829/image.png) Cheers
Member

Added subscriber: @Jens_Eopus

Added subscriber: @Jens_Eopus
Member

I'm unsure if @Jens_Eopus is with unity, but he posted a fix earlier today in D13894: Fix: Launcher: wait for Blender to exit , i can tickle the bots if you want a binary version to test/play with

as for 2.93, you appear to be correct, i am mistaken there, i pulled up the commit f3944cf503 and it's definitely 3.0+ only, sorry for the confusion.

I'm unsure if @Jens_Eopus is with unity, but he posted a fix earlier today in [D13894: Fix: Launcher: wait for Blender to exit](https://archive.blender.org/developer/D13894) , i can tickle the bots if you want a binary version to test/play with as for 2.93, you appear to be correct, i am mistaken there, i pulled up the commit f3944cf503 and it's definitely 3.0+ only, sorry for the confusion.
Member

This seems to have an easy fix on the Unity side that doesn't require waiting for any fix from us.

When you get the path associated with ".blend" files from the registry, just replace the file name with "blender.exe". This is the same strategy that the launcher itself uses to locate the Blender executable (Get own path with GetModuleFileName, replace file name with "blender.exe", open that with CreateProcess).

This seems to have an easy fix on the Unity side that doesn't require waiting for any fix from us. When you get the path associated with ".blend" files from the registry, just replace the file name with "blender.exe". This is the same strategy that the launcher itself uses to locate the Blender executable (Get own path with GetModuleFileName, replace file name with "blender.exe", open that with CreateProcess).

A build of https://developer.blender.org/D13894 would be awesome - I can test it right away!

Thanks guys!

A build of https://developer.blender.org/D13894 would be awesome - I can test it right away! Thanks guys!
Member

kicked the bots, the build should popup over at https://builder.blender.org/download/patch/ in the next hour or so.

kicked the bots, the build should popup over at https://builder.blender.org/download/patch/ in the next hour or so.

That's great @LazyDodo !
If this ends up working (I'll grab it hot and try right away), would it only exist in 3.1 or is that something that could be backported (if that's a thing in your workflow)?

That's great @LazyDodo ! If this ends up working (I'll grab it hot and try right away), would it only exist in 3.1 or is that something that could be backported (if that's a thing in your workflow)?
Member

@EtienneArchambault_Unity - If this ends up working...

Then that confirms the issue, but you don't have to wait for us to release that change. When your code gets the associated path to ".blend" files in the registry, just clip the filename off that path and add "blender.exe". That will work immediately for current, older, and newer versions of Blender. It will also work if I personally decide to associate "blend" files with a custom batch file that uses specific arguments.

> @EtienneArchambault_Unity - If this ends up working... Then that confirms the issue, but you don't have to wait for us to release that change. When your code gets the associated path to ".blend" files in the registry, just clip the filename off that path and add "blender.exe". That will work immediately for current, older, and newer versions of Blender. It will also work if I personally decide to associate "blend" files with a custom batch file that uses specific arguments.
Member

There is a corrective 3.0.1 release planned for the 26th, but we're cutting it awfully close here, I can't guarantee this will make it in time or that it even will be accepted in this corrective release by the release manager.

There is a corrective 3.0.1 release planned for the 26th, but we're cutting it awfully close here, I can't guarantee this will make it in time or that it even will be accepted in this corrective release by the release manager.

It works!
So now if I set launcher-blender.exe from 3.1 as the default for .blend, files re-import correctly in Unity.
(And if I set it back to launcher-blender.exe from 3.0, it stops re-importing)

The only tricky thing is that from the moment you install 3.0 (with the installer), or set the launcher-blender.exe from 3.0 as default .blend, the only way you can change it is by invalidating its path (changing the currently assigned .exe name for example).
Only once it is invalid can you then point to a new .exe - otherwise it just silently does nothing.
I'm really puzzled by this behavior.

It works! So now if I set launcher-blender.exe from 3.1 as the default for .blend, files re-import correctly in Unity. (And if I set it back to launcher-blender.exe from 3.0, it stops re-importing) The only tricky thing is that from the moment you install 3.0 (with the installer), or set the launcher-blender.exe from 3.0 as default .blend, the only way you can change it is by invalidating its path (changing the currently assigned .exe name for example). Only once it is invalid can you then point to a new .exe - otherwise it just silently does nothing. I'm really puzzled by this behavior.

If a user of 3.0 would set blender.exe as default, would this cause any problem?
Because right now Unity users wanting to use 3.0 would only be able if they force it to blender.exe instead of launcher-blender.exe

If a user of 3.0 would set blender.exe as default, would this cause any problem? Because right now Unity users wanting to use 3.0 would only be able if they force it to blender.exe instead of launcher-blender.exe
Member

I have a hard time following how you are doing these things, you should use the preferences panel in blender, under system there should be a button to make this instance the "current blender" it will then be used to launch .blend files. your current 3.0 build naturally won't be fixed by the D13894 build, unless you copy over D13894 's the launcher executable.

I have a hard time following how you are doing these things, you should use the preferences panel in blender, under system there should be a button to make this instance the "current blender" it will then be used to launch .blend files. your current 3.0 build naturally won't be fixed by the [D13894](https://archive.blender.org/developer/D13894) build, unless you copy over [D13894](https://archive.blender.org/developer/D13894) 's the launcher executable.

Yeah it's a lot of shenanigans to get the defaults to point to the right exe... It's great that you guys added it as an option within Blender - should help going forward!
I tried using the launcher from 3.1 in 3.0 but it kept launching 3.0 - but it might just be on my side

Yeah it's a lot of shenanigans to get the defaults to point to the right exe... It's great that you guys added it as an option within Blender - should help going forward! I tried using the launcher from 3.1 in 3.0 but it kept launching 3.0 - but it might just be on my side

I just tested the build and it worked for me.
Setting up the default program via preferences worked fine.
Doing it via "Open with..." is really annoying because Windows only reports the EXEs Productname which happens to be "Blender" no matter whether if it's the launcher or the blender.exe or if it's 3.0 or 3.1

Our current workaround is having deleted all the blender-launcher.exe from all company work stations.
This way it's not possible for any user to pick the wrong "Blender" and accidentally messing up our cache server with screwed up imports, forcing me to clear the cache again.

I just tested the build and it worked for me. Setting up the default program via preferences worked fine. Doing it via "Open with..." is really annoying because Windows only reports the EXEs Productname which happens to be "Blender" no matter whether if it's the launcher or the blender.exe or if it's 3.0 or 3.1 Our current workaround is having deleted all the blender-launcher.exe from all company work stations. This way it's not possible for any user to pick the wrong "Blender" and accidentally messing up our cache server with screwed up imports, forcing me to clear the cache again.
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

@LazyDodo : if D13894 lands today, I can still sneak that into 3.0.1

@LazyDodo : if [D13894](https://archive.blender.org/developer/D13894) lands today, I can still sneak that into 3.0.1
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

This issue was referenced by ddf92d719b

This issue was referenced by ddf92d719bd41fd824affd5fc98f9fd8249b4b15

This issue was referenced by e673cfc2d7

This issue was referenced by e673cfc2d703da93e6df72fc657660b8235494e8
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Ray molenkamp self-assigned this 2022-01-24 16:44:12 +01:00
Member

Fix will be in 3.0.1 ddf92d719b

Fix will be in 3.0.1 ddf92d719b
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
9 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#95099
No description provided.