First, you will need to download Aseprite. Next, you will of course need Unity so please see the Unity subwiki for that.
Finally, you will need the Anim_Import.cs script.
How to use Anim_Import
:
Steps:
Locate aseprite.exe This is an absolute must. Without having Aseprite installed on the current machine, the program cannot import data from .ase files. The program assumes you'll have it installed at the default location, but this may differ depending on how you installed Aseprite.
Locate the art folder The program tries to do this automatically by assuming it is located in the same directory as the Unity project, but this may differ from project to project. Enter the location in the "Art Folder" field.
Extract data from .ase file Once you've located the art folder, the "Aseprite File" field will update to include a list of all .ase files it has found. (.aseprite files are ignored, unfortunately). The currently selected file will be where all the animation data is imported from. By clicking "Extract From .ase File" the program will create a subfolder called "JSON" to put all the information it extracts.
[optional] Select GameObject From the project, select a GameObject whose animation you would like to update. If you only wish to view the animation data from the .ase file, simply deselect "Apply Directly to Object"
Import Animation Data Press "Import Animation Data" to run the bulk of the program. It will import animation data from the selected .ase file in the "Aseprite File" field. If successful, the program will both output the data in the text area "Anim Data" as well as update every AnimationClip attached to the GameObject.
Selecting "Show Frame Data" will show where each frame should be located in regards to sample index. This can be used for debug purposes.
Typically .ase files contain loops. The program assumes that you want to create AnimationClips of with the same names as these loops, as this generally is how the animation is first created. However, since it goes through the existing AnimationClips first instead, it will not import the animation if the .ase file does not contain a loop of the same name.
I haven't programmed the capability of adding AnimationClips using .ase animation data, so you'll have to first create a dummy Animation for each GameObject if you want to use this program. Sorry! Note: If you want to program that yourself, go ahead and implement the method called createClips()
. Also, in onGUI()
, make sure to change the variable update
to enable that method!