Search Unity

Unity and Flash : a sneak peek.

Over the last few months here at Unity, we have been hard at work on, amongst many other cool things, the ability to publish from Unity to the Flash Player. This means that next to the already existing build targets of a Unity project, one will be able to target Flash with Stage3D, announced for Flash Player 11.

Since our initial announcement, there has been a great deal of interest and many people have questions on what Unity supporting Flash means. Today we lift the veil for a sneak peek.

Unity for Flash Developers

We are organizing a Flash day on September 27th, the day before the Unite conference, aimed at getting Flash developers up to speed with Unity development. On this day we’ll be showing and telling about the Flash support functionality and giving entry level overviews of Unity to get you started.

If you are a Flash developer or designer interested in getting started with Unity, this is a great kick-start to enjoy the Unite Conference following the days after.

If you are interested in learning more about our Flash support, meeting the Flash team at Unity, asking us questions about it or just look at the demos we’ll be showing, we are looking forward to see you there !

The Unity Flash day is free (please do register though), and right now, there are still tickets available for the Unite conference.

Can’t make it out for Flash day ? Sad panda ? Well, we have some good news ! Let us shed some light on our work with a sneak peek right now….it includes a video and it is the first time we are showing our work publicly.

A sneak preview

This video preview shows the Shadowgun game demo by Madfinger Games, a highly anticipated iOS & Android Unity built game. Except now, it is exported for and running in the Flash Player !

While we are not quite ready to ship with Flash support yet, we just couldn’t resist sharing this video with you, as this has been a major milestone for us. We’ve taken the project, changed the build platform to Flash, hit build; magic happens…and the game runs in the Flash Player.

Performance is great and things are looking very promising. Keep in mind, this is a sneak peek; many things are still rough around the edges. Rest assured we are working hard to ship this, there is nobody who likes to see this in your hands as soon as possible more than we do.

Features, features, features.

Many of the features available in Unity today and in the future will be directly available for Flash when we release our Flash export feature. For all of you that are interested in, but less familiar with Unity we’d like to highlight some features that currently already work for the Flash export of our internal Unity build right now.

Unity has an integrated physics solution powered by NVIDIA PhysX. Used for things like rigidbody, ragdoll and realistic car physics, this will make your world come alive with fast and accurate physics. We’ve been testing it out on Flash with some complex scenes and it runs smooth and fast ! For the initial release of our Flash support we will probably not be supporting cloth and soft bodies. All in all this feature combined with the ease of Unity’s editor is hugely powerful to build rich and realistic dynamic worlds.

Adding atmosphere to your scene with advanced and beautiful lighting, can be done from within the Unity editor, using the built in Beast lightmapper. Since the lightmapping is done offline in the editor, it has very little impact on the runtime performance of your game, while adding much more visual depth and atmosphere to it.

With built-in Umbra Occlusion Culling, Unity adds a performance optimization to render only what’s actually visible for the viewer. Visually, the result is the same, but now optimized and faster rendering, with little effort needed to do so.

Everything rendered in Unity is done so with shaders. While Unity ships with 60+ shaders, you can also build your own. The best thing ? Our Flash port automatically converts this to Stage3D AGAL assembly and does all the hard work for you, no extra work involved.

This feature, planned for Unity 3.5, adds really nice and fast dynamic lighting. As the ShadowGun demo shows, lightprobes have a great effect on your scene’s lighting. It renders at a relatively little performance cost and adds lighting details to your scene and it’s dynamic objects, adding to both realism of lighting and visual beauty.

Fire, explosion, debris, fireflies; particle systems add many types of animated detail to your scenes; the current particle system as well as the up and coming new ones, planned for 3.5, fully work for Flash.

Unity can build your games for many different platforms already; and the scripting is portable from platform to platform. With a dash of magic (read : blood, sweat and tears) by our dev team, we support the exact same functionality for Flash. If you script your game with C# or strict JavaScript, everything gets converted to and compiled as ActionScript. This keeps your games portable between platforms and allows existing users using C# to easily target the Flash platform. For the first release we will also support most basic .NET library functionality.

Unity will automatically generate navigation meshes from your level geometry.
Beautiful, natural-looking crowd simulation using RVO and PLE algorithms wrapped in a simple API. Agents can find paths to target locations with built-in crowd simulation, or can be moved directly on the NavMesh in a similar way to the character controller.

Adding audio to to 3D positions and having your player experience the audio of that point in space adds another layer of depth to your game. For the first release of the Flash support we will only support the basics, without effects. However, all normal editor features are retained, allowing you to easily add immersive audio to your game.

Unity supports seamless import and modification of your assets using 3D modellers and Photoshop. With the addition of Flash support, this means that getting from a set of assets to making it interactive with the Unity editor to publishing it for Flash will be as smooth as it is already. We think getting this kind of ease of use for your production is currently unseen for the Flash Platform.

Specifically for Flash support, you’ll be able to communicate between the project and other ActionScript code. This means that you don’t lose any Flash functionality and it allows for tight integration between Flash and Unity. It allows embedding the Unity exported content within your existing Flash project and communicate between your Unity and Flash content.

Preparing now to build for Flash

The above is just a short list of highlights that work out of the box, amongst many more. We are still hard at work on Flash support, however there are some things that are not likely to work in the first release. We’d like to point them so you can start working on preparing your projects for Flash.

Anything requiring mouselock (unfortunately this is a Flash Player API limitation, it has no mouselock)

Video (however, flash video can be controlled using ActionScript messaging)

Terrain engine

Deferred rendering

Over time this list will get shorter, but we do not plan on holding back a first release for the lack of any of those features. As for the question “when is it done”; at this point we are not able to give you an exact shipping date yet. We’ll follow up with another post when we know more.

We hope you enjoyed this little sneak, are looking forward to hear what you think and will hopefully see you at our Flash day or Unite !

@Mike deSimon: it does not. Also, Adobe only cancelled the mobile Flash plugin, which never really worked in the first place (iOS never had it, half of Androids did not have it either). Mobile AIR is still alive & kicking.

This is awesome news, although one question i can understand why most of the “not yet” implemented features are there such as deferred rendering since that is almost impossible to do with current Molehill version i don’t understand why the Terrain is not supported.

Great! I am only missing one thing regarding Flash: I would like to import FLASH animation as texture to an object. Is that anywhere in the ropdmap? Would be great for integration of existing assetts. :D

Have to say, the quality and functionality seemed pretty solid, if not at least for a flash game. While I just don’t like AS3 for object referencing being able to do this opens up a few doors. If nothing else, makes for a really fun way to demo a game regardless of it’s actual platform with the availability of Flash.

You are missing the point here. This is most genius marketing strategy to date. Thanks to this move Unity wins over millions of Flash developers around the world. So what do you think happens in 5 years? There maybe possibility that Flash is dead and HTML5 rules the world. What then? Unity by then is already owning millions of flash developers who are seeking new ways to produce content. And Unity will be there to provide this service for them.

Why? What’s the purpose of this? Unity already plays on all mobile devices, web, pc and mac. This just seems like a big waste of the companies time and effort when they should be focusing on improving what they already have!

Unless I missed it, I would like to know if this still requires the end-user to have a the Unity plugin? I love Unity, but the challenge in developing for it is user adoption. Does this mean that the plugin is no longer required?

I remember back in about 2000 when I was at a start up company and we were playing Unreal Tournament and working with Flash 4 … today is the day that those two environment comes together in a beautiful way. I love the last part where he right clicks to see Flash Version 11 …. just awesomE!!!!

So you can port your whole engine over to flash and you got trough all the hassle of converting msil(or source to source?) to action script, BUT you don’t want to port over your engine to Windows Phone 7 with XNA / Silverlight 5?!

not sure about the utility of this…..you can play the game already with the unity web player, plus flash is well known for being slow and eager to suck all your resources; imagine now running a game that is resource intensive per se….on slow computers basically they will just sit.

The only advantage that i see is that it can run on mobile platform, anything that can run flash can run the game (anything but iPhone and iPad basically) but what would be the point? Reach more people? Publish games on the sites that has casual games and become one of the million of developers that bury their precious work in huge cauldrons with millions of clones of this or that game?

Technically is a great milestone, but for practical uses, I am less than impressed honestly…..the flash game ain’t gonna run on xbox, ps3 or wii, so does no good to me, since i can already publish on iOS and android anyway plus web.

MAybe is just me not getting what all the fuss is; everyone else commented like this is the best thing ever happened to Unity engine; to me it looks like a waste of time in resources that could be used to implement different features in the engine, but that’s just me.

Good job guys (independently if i like it or find it useful it is a great achievement ).

每日一顶， everyday up.its very good to hear that the flash export support will come soon，But I got one concern。 Does the free edition has this functionality？ Or I got to buy a pro edition，or there will be a flash edition just like the ios edition and android edition.

But one word about all the flash developers here crying for AS3 support instead of UnityScript (BTW which is like trading devil against messias) and the like ;). The only reason Unity is going to support Flash is because of its great or overwhelming market share. The technology behind flash is nothing but garbage as is AS3, so please don’t try to mess up Unity with AS3 and the whole Flash trash, and start learning some sane technology right now. UnityScript is as well a pile of junk, but thank god Unity also supports C#…

Rich: point well taken and i agree that with native apps its nice to have one tool to target multiple platforms. But there are also web apps. Some products benefit from web apps more than native and this all depends there is not one cure all but with web apps apple has decided not to support Flash not adobe or myself. If im in a nitche where the web is my ‘free’ app store its apple who is descriminating the web by not supporting flash beacause they did not want flash in the way of thei media distribution layer. So my point is if android will support flash for the web then thats what i need

@Jonathan flash day will have a demonstration of the flash export, followed by a few sessions to introduce people with a flash background to unity basics. For nitty gritty details on flash export, come see the flashexport team at Unite, either in a yet to be announced session, or in the hands on labs.

Future updates of FP11 will also include Multithreading, and what I see today makes me more comfortable about the future of Flash. 3 Years from now we’ll be on Flash player 14 while the world be on HTML5 for the next 10. we build Enterprise apps and I don’t care if we don’t don’t capture the iPhone market as long as our customers have a droid.

Check out the Samsung Note. It’s a phone/tablet(1280×800). I can’t wait for FP11/Air to be ready for Android. If this works as expected I can convince our customer to buy a Droid over an IPhone/Tablet. you guys need to hurry!!!!.

What will happen if you try to author the content with unity and then export/mix to the air for android/ios compiler thus rendering the basic mobile licenses a little useless? Is there going to be a significant performance hit or not even possible?

Would it be worthwhile to come to the Flash day to learn any quirks about Flash export, or will it not be that in depth? This is something that our clients are certainly very interested in so I want to know it all. :)

@bali: just like for all other platforms that Unity supports, the source data format does not matter. After assets are imported, they live as internal binary serialized data format. So if you have exactly the same mesh in Collada, FBX, Maya file etc. – it will be exactly same mesh data bytes in the game. Same for all other asset types. So in Flash, all game “data” is basically binary embed data stream(s).

I have one question. How mesh and animation are managed/exported when the project is exported to flash format ? I mean, let’s imagine I have a Colloda file with cache for the animation in my scene, how it will be managed by the swf export ? Does the Collada file still exist and loaded by the swf file or Unity compile all mesh geometry and animation in class file ?

Second: I too am curious whether there’s going to be any way to set up intelligent / lazy loading of assets. One of the things we have to concern ourselves with is not making the user wait too long to download our games, and putting the whole thing into one giant swf doesn’t let us lazy load assets as they’re needed.

Third: Can the resulting swf’s Document Class implement an interface? In other words, if we want to allow it to be loaded by another swf and let that loader have hooks such as to start / pause / collect score information / etc, can we do this?

@Jesper : right now we support sending messages between your project and the unity exported project.
@Sirithang : Where Flash runs this will run. However, Flash will make the decision if hardware acceleration or a software renderer is being used, based on OS, drivers and gfx.

Wait….does that mean that this run under Linux? Flash Player is alway ported to Linux, but i’m not sure about their 3D API, but if they do, that could be the first step of Unity into the wold of Unix and that would be a new player base open for both Unity and Game maker….

Wouldn’t it be brilliant if Flash just used mono with an actionscript parser. Unity wouldn’t have any problems then. Actually.. I’m surprised mono isn’t a standard included plugin by itself for all web stuff. Basically can javascript die please? :)

And if you want to create/use smooth vector rendering inside Unity like you can in Flash, soon you’ll be able to using the RageTools + RageSpline combo – with SVG files import, advanced “magnet” deformers, real-time scale compensation (for consistent edge anti-alias and blur) and even vector Text generation! Follow @brenoazevedo for continued updates.

@Geoff
This is still WIP stuff, so no final word on performance. We’re obviously able to do more optimization tricks in our own plugin, but I’m seriously impressed and surprised by the performance the flash export team were able to deliver.

I’d estimate that performance is probably going to end up like this:

Unity plugin > Native Client > Flash

However you control your builds and can therefore throttle runtime performance requirements based on platform. Optimum usage of our web distribution capabilities, when fully deployed, as I see it would probably be something like this:

1: Website does plugin detection.
2: Content is made available if plugin is available in the prioritized order: web player, native client, flash.
3: The builds are customized to fit the performance of their platform – so lower performance means same end performance, but quality throttled down.
4: In case of native client and flash, the website offers to have the Unity plugin installed for optimum performance.

Will there be a scene that acts as a preloader or any other method to show the SWF loading progress to the user? It takes a little for the game to start with a blank blue screen. ;) Other than that I love it.

I’m not here to say anything useful, I just wanted to add my collective whoa!! to the list :) That looks utterly incredible. No wonder Adobe provide zero tools for game devs with something as stunning as this around the corner.

@James B : It’s mentioned in the post, but we have no shipping date yet. However, I can give you a definitive answer on FP10, no it won’t. We rely on the Stage3D feature in FP11, without hardware acceleration this wouldn’t be possible.