Snow Leopard’s 64-bit Safari and Unity

Update: We have released Unity 2.6.1 on December 2nd this year, which includes an update to the Mac Unity Web Plugin, which is fully compatible with 64-bit Safari on OS X 10.6 Snow Leopard.

So, most of you have probably heard the news: Apple is going to release Mac OS X 10.6 «Snow Leopard» this Friday. This release will give Mac users plenty of new feature goodness and new technologies to play with, and brings a lot of changes under the hood. Unfortunately, I must inform you that one of these changes may cause some grief for Unity users, at least for the time being:

Apple reengineered Safari to run as a full 64-bit application. While this is a good thing, it has a pretty big impact on plugin developers like us. Even though plugins do not actually need to be 64-bit binaries themselves, since they are now running as separate processes, they need to communicate with Safari using new 64-bit capable APIs. Basically, the old Carbon-based NPAPI is being replaced with a Cocoa-based version, which requires a lot of restructuring of plugin code.

Unfortunately, this change sort of caught us by surprise — the APIs which are now required have just been publically released in Safari 4.0, and are now being made mandatory to use in Snow Leopard less than three months later. Which now means that we won’t be able to ship a working web plugin for 64-bit by it’s release date this friday. We are working on it as hard as we can, and we do have a working proof of concept of Unity web content displaying in 64-bit Safari. We aim to release an updated plugin in October.

Until then, there are two possibly ways to play Unity web content on Snow Leopard: One is to use Firefox, which still works as always. The other one is to set up Safari to run in 32-bit mode. To do that, click Safari in the Finder, select Get Info from the context menu, and click on Open in 32-bit mode.

When users open web pages with Unity content in 64-bit Safari, all they will see is a blank screen where the content should be. However, it is possible to detect this situation from JavaScript, so you can at least display a meaningful error message on your site. When the plugin fails to load, the GetPluginVersion() function is undefined. Here’s some sample code, showing how to use that to display an error message:

If you are using our default html template, you can just add this code after the line document.write(»);.

We apologize for any inconveniences this causes, and, as always, we will try to resolve the issue ASAP. Looking forward, though, moving to these new APIs will make the Unity web experience a better one, as this allows us to do more robust input handling, and proper layering of Unity content with other parts of your web site.

Oh, and before anyone asks: The Unity editor as well as standalone games made with Unity are unaffected by this issue.

@Conrad: This is not so much a question about Carbon vs Cocoa. It is a question of using a new API to communicate with the browser. If we had been using the previous, Cocoa web plugin API (WebKit), we would have been just equally screwed, because that is no longer capable of rendering OpenGL content in 64-bit Safari either. This is due to the way plugins are executed out-of-process now.

You should not be in the least bit surprised by this. It has not been ‘rushed’ out. Even before Leopard (not Snow Leopard) Apple have been telling developers that they are discontinuing support for carbon (at least 3 years ago). They have continually told developers not to use it, and to use cocoa instead.

@Robert: I’m sorry but that is simply not something we can offer to do, we’re just not in a position to take individual names and notify you about this sort of issue. Please keep your eyes on our News page and/or RSS feed, or these blogs for any updates. Thanks!

@Chris: it’s not caused by 64 «bitness» per se. It’s caused by 64 bit Safari deciding «from now on, we’ll force all plugins to use a different set of APIs». I guess Apple just chose transition to 64 bit as the moment in time to make this change.

I can’t believe that you are that surprised by this, everything, both Windows and Mac, has been heading towards 64-Bit for a couple of years now, so I am always shocked when a company doesn’t support 64-bit yet.

@Pirks: maybe Apple did let Adobe know about the changes earlier? Also, maybe Flash in Windowed mode does not use OpenGL. Just guessing here, but Flash is very widespead and surely gets a lot more attention than all the smaller web plugins.

If Flash had the same problems as Unity does, sure, we can do the same fixes. But we need to 1) figure out what and how needs to be fixed, and 2) fix it.

@Askhan: and why don’t we avoid poking and prodding at OS-war comments here, m’kay? :) Neither Microsoft nor Apple are perfect, each has problems, each has benefits, use what suits you and go from there.

@Ashkan: IE8+Vista fullscreen problem is not solved for Unity Web Player yet. Microsoft did not respond to our bug reports either. For 64 bit Windows users in general, there are no known problems — Unity editor, player and web player all work there just fine.

@apple fans
OSX with all of it’s strength is not as developer friendly as windows. IE8 was in beta for several months and many compatability articles are available to help you solve your site or plugin problems with the new browser altho it has a problem about something that unity can not be shown full screen there. is there any problem for windows 64bit users? i know there is not much win64 users.
good luck

I also would like to take your attention on the fact that the FBX I/O plugin doesn’t work at all with cinema 4D when this one is used in 64 bit mode. A collada support would be more appropriate. Thanks a lot!

I think it’s kind of unfortunate that Apple rushed this in like that — but I think it’s cool that you do your best to stay on top of things (even if, for now, that means a bit of working around the issue for us). I really appreciate how you’re handling this situation … and good luck on the plugin-interface refactoring! It’s also nice to know that this at least has some advantages ;-)