More Unity3D to flash conversions

February 17th, 2012 by Slav

I recently downloaded the latest version of Unity 3D 3.5 demo – release candidate 1 to further test the flash export capabilities.  I have to say I was impressed and it’s certainly a big step forward – long list of bugfixes and some new implemented features speaks for itself.

To test the flash conversion I made the 2 demos.

Click on the images to play demos.

Car demo

First it’s just a very simple demo with high poly car model,  plane , camera and one directional light. I wanted to see how the dynamic shadows would be rendered and whether the high poly model would cause any performance issues.  It’s using standard fps controler and a mouse look for the camera. To get reasonable looking dynamic shadows shadow resolution had to be “Very high Resolution” and also Shadow distance in Quality settings had to be increased to 300. Otherwise shadow started to disappear if you moved even slightly away from the car with the camera.


  • Model renders smoothly and fast enough (as expected if you have good GPU).
  • Lens flare effect on the light now renders correctly


  • There’s a banding effect on the shadowed area both on the floor texture or inside of the car
  • Some materials were not correctly transferred from the max files

Car racing tutorial demo


This was the conversion of a racing game tutorial . This is of course much more complex example and there were multiple issues with this conversion. Quite a lot of issues had to do with terrain object, which is currently not supported for flash platform build target. Removing Terrain, solved about a half of the compiler errors, but I had to remove also parts of code that referenced it, and with it also code that check the rendering and hiding the objects that don’t need to be rendered.

There were compiler errors that had to do with classes of the same name being defined twice. For example SoundControler was a class in C sharp but also in Javascript. Or Skidmarks was defined as a C sharp class but existed also as a shader under the same name.

I think it’s a pity that Terrain object isn’t supported as it brings a lot of convenience to the environment creation. I think there already must be an algorithm to converted it to mesh and apply textures ? As GPU can only work with polygons ? Why not do that for flash conversion as well and have a settings to how much detail would terrain have?

Ok, so here are some cons and pros


  • car runs pretty smoothly all the physics and lightning works quite nicely
  • lens flare now works fine as well


  • the same banding effect on the shadowed areas
  • no car sound effects only when collision occurs
  • for some reason if you speed up with the car it will stop rendering scene (ok this one might have to do with me disabling some parts of the script to get rid of compiler bugs : – ) )
  • there’s a slight space between the shadow and an object casting that shadow (you can notice that on the wheels for example)
  • Even without terrain the demo has 22 MB. Non development build.

Other than that, it’s pretty sweet and playable (apart from speedy non render bug).

Posted in AS3, flash, Unity3D | 10 Comments »

Unity3D to Flash First Person Shooter game conversion

January 3rd, 2012 by Slav

Had some free time around Christmas, so I decided to have a look at Unity 3D since it looks like (at this time) only reasonable way to do 3D in flash. Yes there are other 3D engines out there like Alternativa, Flare 3D, Away 3D, but none of them have a visual editor that comes even close to the Unity’s IDE.
The version that supports export to flash have been around a few weeks now, so I thought I’d give it a try.

Firstly I did a scene with the high poly count that tested the GPU rendering. This was absolutely fine, as the performance relied heavily on the GPU.
One thing I noticed though, that Terrain object wasn’t being rendered ? I guess it’s because in Unity Terrain is more of an abstract construct / game object rather than actual mesh.. Although, I’d imagine it would make sense to converted to editable mesh for flash ?

Secondly I tried converting an existing FPS game. It was a FPS tutorial made by Graham McAllister.

You can see the result here.

The conversion was pretty straightforward, there were a few compiler errors that needed fixing, but nothing too major.

The game itself work quite allright, there are some bits missing (like the lines of fire from the automated shooting robots) , but I guess it could be down to me not having a pro version..

The swf file size is 8.6 MB which is pretty hefty compared to normal 2D games or websites, but then, it’s a complete game , with lots of textures, meshes and sounds.

Also absence of mouse lock is quite evident, but this is fault of the flash plugin, not Unity. Support for mouse lock is coming soon though!

All in all, this is still a preview version, I imagine a lot of things will be fixed , optimised , added.

So far I am quite impressed (well done Ralph and team !)  and we’ll see how will it compare to the Unreal Engine to flash conversion!

Posted in flash, Unity3D | 11 Comments »