Getting Started with Flash Development
What is Unity Flash?
The Flash build option added at Unity 3.5 allows Unity to create swf (ShockWave Flash) files. These swf files can be played by a Flash plugin installed into your browser. Most computers in the world will either have a Flash Player installed, or can have one installed by visiting the Adobe Flash website. Just like a WebPlayer build creates a file with your 3d assets, audio, physics and scripts, Unity can build a SWF file. All the scripts from your game are automatically converted to ActionScript, which is the scripting language that the Flash Player works with.
Note that the Unity Flash build option exports SWF files for playback in your browser. The SWF is not intended for playback on mobile platforms.
Performance Comparison
We do not currently have direct comparisons of Unity webplayer content vs Flash SWF content. Much of our webplayer code is executed as native code, so for example, PhysX runs as native code. By comparison, when building a SWF file all of the physics runtime code (collision detection, newtonian physics) is converted to ActionScript. Typically you should expect the SWF version to run more slowly than the Unity webplayer version. We are, of course, doing everything we can to optimize for Flash.
Further reading:
- Flash: Setup
- Flash: Building & Running
- Flash: Debugging
- Flash: What is and is not supported
- Flash: Embedding Unity Generated Flash Content in Larger Flash Projects
- Example: Supplying Data from Flash to Unity
- Example: Calling Flash Functions from Unity
- Example: Browser JavaScript Communication
- Example: Accessing the Stage
Other Examples:
- Forums post - Loading Textures from Web (in AS3)
Useful Resources:
- Scripting Reference: ActionScript
- Flash Development section on the Unity forums
- Flash questions on Unity Answers
Note: The Flash export feature is currently available as a developer preview. This feature is still in development and thus the above information is subject to change.