How to Export a Toon Boom Harmony Sprite to Unity

Mark PhilippAll Topics, Animation and Storyboarding, Tutorial, Unity Game Development

How to Export a Toon Boom Harmony Sprite to Unity

Share this Post

One of the most important features for any 2D design software is how it can integrate into your workflow. For game developers, it’s important that your design and animation tools can work with your game engine with few or no issues. Toon Boom Harmony offers a pipeline for exporting sprites and animations directly into Unity 3D. In this post, we’ll look at how we can use Harmony’s Unity SDK to bring a Harmony sprite and animation into Unity.

Install Unity Middleware

First, we need to setup our Unity Middleware so we can smoothly work between Unity and Harmony.

  • Open Unity and create a new Unity Project

NewUnityProject

  • For the new project, set it as a 2D project, call it whatever you want, and click OK.

NewUnityProjectSettings

  • Once the editor opens, click the “Window” menu and choose “Asset Store” from the dropdown.

AssetStoreDropDown

  • In the Asset store window, use the search bar near the top and type “Harmony game sdk” then press ENTER.

AssetStoreSearch

  • In the search results, scroll down and find the “Harmony Game SDK” and click on its name to open the download page.

HarmonyGameSDK

  • Scroll down until you find the download button. Click the download button.

DownloadSDK

  • Once it’s downloaded, Unity will open an “Import Unity Package” window. On this window, leave everything default and click “Import”.

ImportSDK

Unity will load all the files into your project. This could take a while depending on your hardware.

Exporting from Harmony

Now, we need to export the file from Harmony and into Unity.

  • Open your Harmony Project that includes your sprite/animation you want to export.
  • In the Camera view, right-click the toolbar section and choose “Game” from the dropdown menu

Harmony Export

  • You will see a few game tools show up in your toolbar. When your sprite is ready to be exported, click the “Export to Sprite Sheets” option on the game toolbar.

ExportSpriteSheets

  • On the Export Window, make sure your “Asset Path” is set to yourunityproject\Assets\StreamingAssets\HarmonyResources

ExportSettings

Set the Asset Name to whatever name you want the asset to have in Unity.

You can change your sprite settings using the “Sprite Sheet Preferences” tab at the bottom of the window. This is useful for setting the dimensions of your sprite. If you want a 4k sprite, for instance, you can set width and height to 4096.

If you are interested in what all the different settings do, I recommend reading this documentation. Scroll down to the section that says, “How to access the export to sprite sheets window” and expand it. That section includes details about all the options at the bottom of the export window.

  • When you’re ready to export, click “Export”. Depending on the size and complexity of your sprite/animations, this process could go quickly or a bit slow.

Using Your Harmony Sprite in Unity

Now, we’re ready to use your Harmony sprite in Unity.

  • Go back into Unity
  • Click GameObject → Harmony → Harmony Texture Object

CreateHarmonyTexture

  • You will be asked for the path to your asset. Browse to yourunityproject\Assets\StreamingAssets\HarmonyResources\name of the file you just exported

You want to be within this root folder. You don’t need to open the spriteSheets folder. Click “Select Folder”

  • You will be asked if you want to create a Harmony Camera. Click “Create”.

CreateHarmonyCamera

You’ll be asked which camera to use. Choose the main camera and click “Create”.

ChooseMainCamera

  • You should now see your sprite in the scene. If your sprite has large dimensions, you might need to scale it down in unity using the scale tool.

SpriteInScene

  • If you want to play your animation, you can select your sprite in the hierarchy and add a Component to it called “LoopAll”.

LoopAnimation

Then, when you press play, you’ll see your animation playing.

Conclusion

That’s the basic workflow to bring a sprite and its animation into Unity. One of the limitations of this workflow is that there doesn’t appear to be an easy way to extract animation clips from the Harmony SDK to use with Unity’s Animator Controller. However, this workflow is great for 2D sprites that don’t have multiple animations. In my next post, I will discuss how we can create Animation Clips from Harmony so we can use the animator controller to trigger animations dynamically through triggers or values.

Share this Post