GAF Media blog

Report from the trenches by Unity 3D game developer using GAF

Developer: LTD Scientific Endeavors
Location: Russia
Game Title: Scifun Steve in SciLand
Game Genre: Education
Framework: Unity3D

 

Using frame animation in Unity3D

As soon as the new animation is created, the link to the animation component SpriteRenderer appears. Unity then prompts the user to drag the frames to the animation window.

Frame animation with GAF in Unity3D

A few mouse clicks and the new animation is in your scene!   The goal for a one second clip is about 15-20 frames. But what if the character includes many different movements such as run, plant, water plants, play, get a suntan, etc.  The resulting duration of the animation would end up being many seconds and possibly a thousand frames. This was indeed our case. Although we had a simple scene, it took more than a minute to load and Unity started to crash because of the RAM exhaustion.  We tried using the built-in Unity SpritePacker to pack sprites in atlases but that resulted in an insignificant 10-20% performance improvement.

gaf, convert flash to unity to get an insignificant perfomance improvement

Possibility of replacing frame animation with skeletal animation

To achieve more significant results, one option would have been to change from frame animation to skeletal animation. Instead of sprites we would have to go to a more complicated pattern (model) with the character drawn from parts of the atlas.

To achieve significant result from frame animation to skeletal animation

And in order to get the animation to work using the skeletal model we would have had to consider using skeletal 2d animation tools for Unity such as: Spine, DragonBones, Anima2D, etc.

But our artist had already created all the animations in Flash.  Upon further ​research we discoverd the GAF Converter Plugin in the Unity Store, and found it to be the best solution to greatly reduce frames and solve our crashing problem.

 

Importing animations from Flash to Unity with GAF Converter Plugin.


Here's a summary of how we did this.

 

  1. Import GAF from the Unity AssetStore.

  2. Drag file *.swf into the converter window.

  3. Create an object and customize it. All the settings are intuitive:​​

 

Settings in GAF plugin in Unity3D

 

The animations were created automatically by the markup contained in Flash.

 

To run the necessary animation using scripting:

 

using UnityEngine;
using GAF.Core;//
Use the space of GAF names

public class Mouse : MonoBehaviour
{
 //
Declare and mark link in the inspector
 [SerializeField] private GAFMovieClip GAFMovieClip;
 
 void Update ()
 {
   if (Input.GetKeyDown(KeyCode.RightArrow))//
When pressing “right” key
     GAFMovieClip.setSequence("run", true);//Run the clip “run” cyclically
 }
}

 

 

Configuring transitions in Unity Animator

 

In Pro GAF version there is the option to use the native Unity-animator which makes the development a lot easier. But we needed to keep in mind that our type of animation didn't  support mixing. Unity mixes clips by default. Our animations would distort on transition between clips. So we turned off the mixing of clips to enable our animation to work smoothly:

 
Configuring transitions in Unity Animator with GAF
 

Editing animation clips

 

If it turns out that you didn’t create all the needed clips in Flash you can create them directly in Unity by using the function updateToFrameAnimator() and point at the needed frame.

 

Editing animation clips in Unity with GAF plugin

 

Results using the GAF Plugin for Unity

 

The new animations created by using GAF reduced the time to load the scenes by 10X! In addition, RAM consumption was also reduced by about 2X.   We're happy we found the GAF Plugin in the Unity Store!  It really saved us on this project.  

 

Useful links:

 

Video lesson "Using Flash animation in Unity" (In Russian)

GAF: Import Flash animation in Unity3D (In Russian)

 

Complex animations and cinematics in Unity2D

Developer: Juicy Beast             Location: Montreal, Canada
Game Title:  Burrito Bison: Launcha Libre
Game Genre:  Launch Flight Action Game
Release date: November 10, 2016
 
For Burrito Bison: Launcha Libre we knew we wanted big, complex and well animated opponents on the ring, after all the feature was in previous installments. However, it was the first time we ventured in the fabulous world of complex animations in Unity and we had to consider several new solutions.
Burrito Bison porting 2d animation from flash to unity
 

Solution 1: Spritesheets

By far the easiest: export each image from Flash and put it into a spritesheet. But with opponents as big as 300x500px with 10 seconds worth of animation, it would mean a couple of 4000x4000 atlas images or 1FPS animations to make it bearable for that poor RAM. These and any combo of compromise in between are obviously out of the question.

 

Solution 2: Use an in-house Flash exporter

The exporter was made and all, but it could only export animation with little complexity and couldn’t do many features, it would limit us in what we could do and using it is not flexible, improving it would be an option, but an expensive one.

 

Solution 3: Use Spine

Spine is a great animation software that can export for Unity. It is flexible and allows for easy and professional work. As we began to learn a little about the software, we realized we were way more comfortable in Flash (we come from a flash background). Really learning to do professional work on it would be expensive for the time and money we had available. It is a viable solution but we wanted an easier one.

 

Solution 4: Use Unity’s animation module

Haha! No.

Seriously, it seemed to be less flexible than Spine, less friendly too for the complexity of what we had to do and we knew very little about it, we still used it for some simple animations in the game.

 

Solution 5: Use a Flash exporter from the asset store

To my knowledge there are currently 2 that work very well. Tried both of them and we found a winner: GAF.

 

GAF: give swf, receive result.

First time I used GAF I was wowed. Without knowing anything about it, I just put our company’s previously made flash intro bumper animation in the machine and it gave me back a working GameObject with the full animation in all its 5-6 levels of nesting, transparency masks, color transformations and skewing glory.

 

You must know that I fantasized about rendering this animation in-engine instead of resorting to video files since we made Toto Temple for all the consoles. Encoding for 8 different platforms is really a pain and then implementing it in 12 different ways is even worse.

 

We used GAF over its competitor for several reasons:

  • Simple support of Masks

  • Support of color changes

  • Ease of use on preparation, export/import and use of the result

  • Can determine the maximum sampling size to optimize sprite sheets

  • The animation can be exported as a GameObject that use exactly the same hierarchy and logic as any GameObject.

 

This last feature is what really sealed the deal. With this feature we could easily make animated dynamic pages and add custom behaviour to elements of the animation, all that using Unity’s common logic.

 

JuicyBeast using GAF Converter for Burrito Bison

This GAF animation has no sprite, all that you see are GameObjects added in the animation within Unity.
 
Burrito Bison animated character 2d animation to mobile

You can see that the collider follows the bunny, I just added a collider to one of the animated sprites and I now have a moving character!

 

This is magic, but it comes with its lot of quirks

First of all, the events are exported, this is awesome! But GAFs exported event system is really not an event system. To be able to use its event system as an event system, I had to create a shell script that would collect and “listen” to all the events and relay them to actual listeners.

 

Also, to get consistent results I had to create one .swf per exported animation, with the animation on the root level of the .swf

Also, updating an animation after you change the hierarchy, remove or add a sprite resulted in broken exports, I had to delete everything and restart. To help me in this, I created a script that would help me transfer the custom infos from one GAF object to the new one. Not a perfect system but better than nothing.

 

Also, as it is quite heavy on the process and in garbage collect, I don’t recommend using this for items that appear regularly in gameplay or simple animations, it is more for special elements that need complex animations than a solution that fits all needs.

 

Despite its flaws, I am literally awed by GAFs magic. If you want to make fluid and beautiful 2D animations for Unity and you are pretty fluent in Flash, GAF is your solution.

 
 

GAF now used by 5000 game developers!

GAF Media is now used by over 5,000 game developers worldwide including some of the largest game studios. This is great validation for the value that the GAF solution provides to game developers as a means to reduce development schedule on their projects. 

GAF Media has users spanning the globe across 70 countries located in North America, Asia and EMEA regions. Since the launch of GAF Media in 2014, users have made over 1 Million animation conversions with our tools. 

GAF Converter is most often selected by its users to deliver a comprehensive solution to porting their animation to mobile. This saves the need to develop their own complex systems to port SWF files to mobile platforms. 

Our GAF team is passionate about playing and developing games. This game development experience has led to deep understanding and comprehensive solutions to the animation processing needs of the game development community.  

We would like to thank all our users for helping us with feedback to iterate towards an industry leading solution that helps game companies speed up their development cycles and get to market as fast as possible.

 

GAF Converter Version 5.2

Hello GAF Users!

Gaf media converter flash to unity swf export

GAF Converter Version 5.2 is released.

What is in the release:

  • Added Paddings
  • Added hint for conversion error
  • Fixed bugs reported by users

New Update! GAF: Flash to Unity v5.1 (Free and Pro versions)

GAF porting flash to unity

Update for GAF: Flash to Unity (Free and Pro versions)!

Version 5.1:
1) A lot of optimizations (up to x3 FPS improvement) 
2) States caching (on asset and movieclip level) will increase your FPS but increase RAM consumption too (be careful with this option) 
3) New Unity GAF Converter features (Extract Sounds, Add custom images into a Texture Atlas, Allow region rotation). More info can be found here: http://gafmedia.com/documentation/how-to/working-with-sounds and here: http://gafmedia.com/documentation/how-to/adding-custom-images-into-a-texture-atlas
4) Dispatch events\triggers support 
5) Fixed issue with Unity3d v5.x support  
6) A lot of fixes for Nesting mode 
7) New sections in GAF dropdown menu (Documentation, Contact us) 
8) WinPhone support 
9) A lot of other important fixes

 

Important:
Before importing this version, please delete the previous one in your project!
Also, you will need to recreate (NOT RECONVERT) your animation game objects. Our code optimizations make this necessary.

Hope you will love it because this version is really fast and furious! 

Have a nice day!
GAF Team.

GAF Converter Version 5.1

Hello GAF Users!

SWF to mobile with GAF converter

GAF Converter Version 5.1 is released.

In this release we fixed following bugs:

 

 

 

  • Fixed a clipping of the baked filters on the rotated regions;
  • Fixed a determination of the SWF Stage size (causes the GAF Preview crash in some cases);
  • Fixed an extraction of the Events when SWF is published with "Strict Mode" turned off.


Have a nice day!
The GAF Team.

IF YOU LOVE SOMETHING, SET IT FREE!

Hello GAF Users!

GAF converter free version to port swf to mobile

Exciting changes in our licenses!

Free license. The Free version now includes almost all the features (except CLI, Sounds, Custom images into a Texture Atlas). The Free license is for companies with less than $100,000 annual revenue.

With the Studio\Enterprise license you will get all GAF Converter features, fast and dedicated customer support, custom solutions (upon request) and additional seats.

Have a nice day!
The GAF Team.

 

GAF Converter Version 5.0

Hello GAF Users!

Staldalone GAF converter swf on mobile devices

This is one of the major updates of GAF Converter. Today we are releasing GAF Converter 5.0 with new features. We are excited to share the news with all of you! Try out the new Standalone GAF Converter 5.0! It is already available for download here.

 

 

New GAF Converter v5 features:

  1. Sound support;
  2. Adding custom images into a Texture Atlas;
  3. Atlas packing optimization with regions rotation;
  4. Offline Preview Mode without GAF watermark.

GAF Converter Version 4.5

Hello GAF Users!

gaf swf files convert to mobile

GAF Converter Version 4.5 is released. In this release we fixed following bugs:

- fixed freezing of the converter during conversion of some SWF files;

- fixed wrong conversion of the raster graphics that appears in some cases;

- fixed alpha issue that appears when used Color Effect/Advanced in Flash Pro;

- removed extra pixel from regions that appears in some cases.


Have a nice day!
GAF Team.

GAF Licenses major update

Hello GAF Users!

We have great news! Based on feedback from the community we've decided to simplify the rules governing the three license levels:

  1. The Free license level now has no usage restrictions!
  2. Additional seats for Studio\Enterprise licenses are now available for FREE!

standalone gaf converter to porting swf files into mobile