Unite11 logo, Unity conference

Today was “Flash Day” at Unite11, which discussed using Unity to publish a swf.  Lucas Meijer & Ralph Hauwert (who started working for Unity in June) were the presenters and did an excellent job with it.

Why?

Unity decided to add Adobe Flash support for people who needed a larger installation customer base. This became possible since the Flash team created Stage3d at such a low API level. But, basically, Unity’s goal is to make sure that you don’t get locked into any one platform.

How?

They created an AS3 API for a large portion of Unity. They will not be publishing this yet, primarily since it is not intended to be read by humans). So Unity scripts are converted to AS3 which then tie in to their AS3 version of the API, and all of this is compiled using the mxmlc compiler.

Demos

They again referenced the impressive ShadowGun demo. Then they showed a few live demos (some spheres with physics falling, being shot, etc). It seemed to work great, but the compile time seemed to take a while. Also, I think I saw the output swf was 13.5 Mb, but I might have seen the wrong file as it flashed by quickly.

They showed a demo of Angry Bots running in the Flash player. They claimed no code changes to target the Flash Player. The game ran nearly perfect (minus a few missing explosions, etc). But nevertheless, it was a very impressive conversion.

What?

  • Pricing: “TBA”
  • Release: “TBA”
  • Awesome: “yes”

Supported in Flash:

  • Unity Physics (IDE controlled)
  • Unity Particle systems
  • Unity Custom & Standard shaders (ported to Agal code automatically for Flash)

Not supported in Flash:

  • Any thing that needs depth textures
  • Advanced audio (Doppler, reverb)
  • Dynamic shadows
  • No mouse-lock (so you can’t make a true FPS where the mouse controls looking)

Be cautious:

  • Huge assets means a huge swf. Be careful.
  • Feel free to push the GPU all you want, be go easy on the CPU.

Supported Scripting:

  • C#
  • JS (strict)
  • Boo

Performance:

Fun quote of the day: “The best way to make your game go faster, is to have it not do stuff” – Lucas Meijer

But basically he was talking about how many things Unity does during compile time instead of runtime, to increase performance. These benefits are translated over to Flash. Examples include Lightmapping/Beast, light probes, occlusion culling, etc. All of these features are extremely awesome and a great benefit.

Asset Imports:

For release 1, there will be no way to import native Flash assets, only a way to control them.

Output:

Everything is published to a single swf (you can include the standard Unity branded preloader if you want it, or create your own). They will eventually support separate asset swf’s from each unity scene, but not for version 1.

Conclusion:

This feature looks freaking awesome. The performance was significantly better than I expected. Nevertheless, for full-blown, large-scale projects, the workflow seems like it could get complicated or bulky quickly. Having said that, this was an early demo, and the team was very open to hearing feedback from the community and adjusting the implementation accordingly (kudos!). So, I will definitely eagerly await the release and believe there can definitely be some clear benefit use-cases for it.

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 3.0 United States License.