Unreal: Mac support (part 1 of ?)

It’s super annoying that searching the internet doesn’t work for Unreal. So here’s something I just learned that might help the next person.

I’m trying to work out why Lightmass refuses to run on my Big Sur Mac. Not even the “direct from Epic Installer” version would work. I was working with 4.26, but the underlying code is unchanged through at least 4.27, and probably 5 as well. The documentation says Macs don’t support Swarm. Okay. So I think nothing of it when the Lightmass stuff times out after 60 seconds trying to do a network call that returns with

checkf(bConnectionEstablished, TEXT("Tried to open a connection to Swarm, but failed"));

But then almost immediately, the Lightmass process dies with

Assertion failed: CurrentThread == GetCurrentThread() [File:/home/user0/gre/sa/UnrealEngine/Engine/Source/Runtime/Core/Private/Async/TaskGraph.cpp]

What’s going on here?

Digging into that block of code… The Recipient isn’t valid, so in the worker thread it’s calling to Ping the MessageEndpoint. Okay. But then it starts waiting for something with FTaskGraphInterface::Get().ProcessThreadUntilIdle(ENamedThreads::GameThread);. What took me a while to understand is that was stating that the calling thread was named ‘GameThread’. Except it wasn’t, it was a worker thread.

How did this ever work?

What’s supposed to happen

  • The Editor needs to be running.
  • That bConnectionEstablished? Has nothing to do with Swarm.
  • It’s a connection to the Editor. For passing back status updates.
  • And is a lie, because to return that “established connection” only checks that the socket can be opened.
  • Which normally does a connect in the actual main thread.
  • And gets a response on the main thread.
  • And sets the Recipient valid in the HandlePongMessage callback. How very clear.

What’s actually happens

But the thing is – and this is what took me many days to figure out – is that just because you can open the socket doesn’t mean you’ll get a response.
For example, if you have your firewall turned on, like it should be.
No version of the Editor and Lightmass is signed for Big Sur, so the Firewall automatically blocks all the traffic.

Even if you ‘enable network connections’ for them both, you have to restart both apps for it to ‘take’, and if you rebuild of the Editor it invalidates the ‘pass’. Which, if you’re developing via a from-source build of Unreal, you’ll be doing all the time.

In the end… you have to disable your Firewall. Otherwise you get an error that makes no rational sense in code that’s written to suggest something else is wrong.