top of page

Exporting 2D Animations to Unity3D



To test my mettle at 2D animating, I decided to attempt something I've only seen on Moho Webinars but never tried myself; Using Moho 2D Animations in Unity!


 

METHODS AND LIMITATIONS

 


As far as I'm familiar, there are 3 main ways to export Moho animations to Unity;

  1. Exporting the animation as a video and using it in Unity

  2. Exporting the animation as an Image Sequence of transparent PNGs

  3. Exporting the Moho rig as an FBX file and importing it into Unity


Let's address all of these options!

The 1st option is the simplest, but also one that has the least applications in game development. Pass.


The 2nd option is also quite simple! Unity's Animation window allows using an image sequence and it works quite well!

A 2D spritesheet animation


The 3rd option is the most interesting and complicated. Moho uses 2D rigs (or "bones") to manipulate 2D vector graphics and pictures. This can be exported as an ".FBX" file to Unity3D including all of its effects and animations!

Moho Bone Animation. The blue triangle things are "bones"!


While I did initially try the 3rd option first out of sheer intrigue, I found that it has many limitations due to compatibility between Moho 2D rigs and ".FBX" supported features. Here is a list of some of the Moho features that are not compatible with ".FBX" files:

  • Vector layers will be exported as though they are images.

  • Remember that when designing a project for FBX output, everything is about flexi-binding. Other binding methods will produce undesirable results in FBX format.

  • Characters that use features like point binding, point bending, curvatures, and other similar features will not move in the same way when exported as an FBX file and imported into another application.

  • Bone scaling and stretching is not supported in FBX format.

This forum thread I found goes into more detail.


Quite a lot of limitations! I feel like I would have to make a very basic animation if I wanted it to work.


This is why I went with the 2nd option in this project.



 

CREATING THE ANIMATIONS

 

I decided to recreate animations from a character in the mobile game Fate/Grand Order.




Using screen recordings from the game, I recreated 3 attack animations as "Actions". Actions are animations that can be created and saved separately so they can be reused later on, or so they might be attached to a smart bone.






"Buster" animation

​"Arts" animation

"Quick" animation


I then exported each animation as a PNG Image Sequence and loaded the image files into a new Unity project in 2D mode.



 

WORKING WITH UNITY

 

The next steps were quite simple since they utilized features that long existed in Unity.


I created a new Sprite object and started creating animation files for each image sequence I had. I then used the Animator window to create a basic state machine:



There are 3 trigger parameters on the left side, and when one is activated it plays the corresponding animation (e.g. the "buster" trigger plays the "buster" animation, etc)


Then I wrote a simple script to set off the triggers when I used a controller input:



The IF statements have an additional check that ensures that the triggers are set only if the current state is "Idle".


Once that was done, I hooked up my controller and gave it a try!



 

CONCLUSION

 

This project served as a very quick "proof of concept" for me for future projects. I love 2D animation with Moho and game development with Unity, and I have been planning on projects where I can marry the two concepts! I might make a follow-up to this in the future using the 3rd option once I figure it out!


Please do let me know if you liked this project and if you have any thoughts or suggestions for

what I could've done.

Related Posts

See All

Comments


bottom of page