Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Import Animated Sprites

Discussion in '2D' started by abstractfragment, Jan 16, 2014.

  1. abstractfragment

    abstractfragment

    Joined:
    Jan 16, 2014
    Posts:
    15
    Hey there, I like to do my animation in flash. Is it possible for me to import sprites from flash into Unity? I'm new to this whole Unity thing (working on my first game). Can Unity use .avi's or something like that as sprites?
     
  2. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,042
    Absolutely! I/we typically do all of our animation in Flash. There are several ways, all with upsides and downsides. There isn't one single solution that fits all scenarios, but there is usually one that fits a specific scenario (or can be tweaked to do so).

    Can you explain (or provide an example) of how your animations are set up in Flash? Are they single images or animated parts? Are they already symbols or on the primary timeline? Do they have nested movieclips? Is the art vector or bitmap?

    Let me know the details of what you have and I can point you to one or more useful solutions..
     
  3. abstractfragment

    abstractfragment

    Joined:
    Jan 16, 2014
    Posts:
    15
    No MovieClips, some of them are primary timeline animation and some of them are nested symbols. They are technically vector within Flash but I used the Pixel Animation plug-in.
     
  4. abstractfragment

    abstractfragment

    Joined:
    Jan 16, 2014
    Posts:
    15
    I hate to bump but this is the one thing I'm stuck on with making my game here/
     
  5. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,042
    I would start with LWF. http://gree.github.io/lwf/
    It is very solid, and will handle nested movie clips. Generally it has worked pretty well. I can't remember if converted the vectors. If it doesn't, you can run through pretty quicly (or create a jsfl) to convert them to bitmaps. The usage takes a few steps, but as long as you follow the steps in the demo it's not to difficult.

    Another option is Grapefrukt: https://github.com/grapefrukt/grapefrukt-export
    It doesn't handle nested clips as well, (it makes them each their own sprite sheet inside the main one), but it handles flattening the vectors for you, and generally provides a pretty decent result. Though it isn't specific to unity, you will have to handle the sheets and xml separately.

    Try LWF first, it should work out for you.
     
  6. enjay

    enjay

    Joined:
    Nov 27, 2013
    Posts:
    14
  7. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,042
    It does export sprite sheets, but it won't export any animation/timeline information. I turns them all into a frame animation, which pretty much loses the value of doing a rigged animation in Flash in the first place. Great if you want to make .gifs for the web, horrible for making games.
     
  8. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
  9. abstractfragment

    abstractfragment

    Joined:
    Jan 16, 2014
    Posts:
    15
    Thanks you guys, I will be trying this all out and keeping you posted. Thanks you guys :3
     
  10. abstractfragment

    abstractfragment

    Joined:
    Jan 16, 2014
    Posts:
    15
    LWF and Grapefruikt are a little over my head at the moment so I'm going to give the sprite sheet method. I am doing frame animation so that works. How exactly do I take this sprite sheet and have it run in unity as a sprite instead of just a picture of the sheet?
     
  11. indeyetz

    indeyetz

    Joined:
    Oct 7, 2012
    Posts:
    1
    zombiegorilla, I'm looking for suitable approach for my task, may I know your opinion please?
    I'm trying to make a 2D character that will have a lot of upgrades. It's a racer on bike and player will be able to upgrade the bike by buying different sets of wheels, engines etc. So I think the best approach is to separate all upgradeable parts and then animate them in Unity using some rigging tools, moving and rotating them to make animations of riding, doing tricks etc. And now my question is if are there any tools for 2D animation in unity that are similar to Flash (I have Flash background)?

    Thank you.
     
    Last edited: Jul 1, 2014
  12. bluo100

    bluo100

    Joined:
    Apr 15, 2015
    Posts:
    4
    To import movie clip symbols(which can be animated) from flash cs6 into unity, right click the symbol in the library panel in flash, and select the "Generate Sprite Sheet" option. Then setup the parameters as necessary until your sprites are well spaced. Set a destination to save the sheet to and then click the button that says "save" or "generate" or something like that. This will save the sprite sheet(and sometimes a simple json or xml file or something which you can delete) as a jpeg or png(depending on what you set up) and you can export it into unity as a normal sprite sheet/atlas.