Working in Unity

The Harmony Gaming Animation Guide is a basic guide on how to import Harmony projects and configure them, design and animate characters, and includes some tips. It is not meant as a guide on how to program games.

The Unity Interface

Here are the main components of the Unity interface and their equivalents in Harmony:

Unity Harmony Description
Scene view Perspective view This is where you set the scene, selecting and positioning environments, the player, the camera, enemies, and all other GameObjects.
Game view Camera view The rendered view from the camera(s) in your game. It is representative of the final, published game.
Inspector Layer Properties Displays detailed information about the selected GameObject, including all attached Components and their properties.
Hierarchy Layers in Timeline view Displays the hierarchy of elements in the scene, and lets you set up parent-child relationships for different game objects.
Project Browser --- Lets you access and manage a project's assets.

The main camera displays the scene and is located in the Hierarchy. To show a Harmony object, you must add a special component. With the main camera selected, in the Inspector, select Add Component > Scripts > Harmony Camera.

Importing Harmony Files Directly into Unity

How to import Harmony files directly into Unity

  1. Create a Unity 2D project.
  2. The SDK Harmony project needs to be imported to your project in order for the assets to be brought in. Do one of the following:

    Go to the Unity Asset Store (!/content/31211) and save the Harmony Game SDK file on your computer. Then import it in your project from the following: Top Menu > Asset > Import Package > Custom Package.
    Search for the Harmony Game SDK in the Unity Asset Store, then download and import the package. You can access the Asset Store from the following: Top Menu > Window > Asset Store.
    NOTE: For each new Unity project, you must repeat step 2 as it contains the necessary files and folders to make the Harmony import process work.
  3. Add the exported game object to the scene by going to Top Menu > GameObject > Harmony >
Harmony Object: Lets you browse for the exported Harmony project folder. If you’ve already saved this to your StreamingAssets folder, you can browse to it through there. Then it adds the Harmony scene to your Unity file, and sets up the rendering, audio, and animation scripts you need to get going.
Harmony Texture Object: Lets you browse for the exported Harmony project folder similarly to Harmony Object, but creates a Unity plane to render your animation on it.

Importing your Hamony files from an empty GameObject

GameObjects are the fundamental objects in Unity that represent characters, props and scenery. Basically everything you create in Unity will be a GameObject. There are two main types of GameObject you can use to import Harmony data:

Create Empty: This creates a regular GameObject in which you can load the exported Harmony data. All the individual body parts on the sprite sheet come in as separate elements, but are treated as one whole object with a dynamically created bounding box. If you put a transparency on this object, you would see the overlapping transparencies of all the individual objects. This creates a higher-quality render and should be the default if you’re not animating the transparency of an object. With this option, direct rendering will read the depth information in the scene but not write it. Note that with this option, the rendering cannot be customized.
Create Other > Plane: Renders the entire character to a plane. This renders your character to texture data. If you animate the transparency of the plane, then the transparency of the rendered output is animated; you won't see the transparencies of the overlapping elements. However, you will have one static bounding box the size of the plane that you render to.

Use this option when you want to animate the transparency of a character in a scene. Also, you can write your own custom shaders. Simply set the Render Target to eRenderTarget. You can see an example of this in the sample project DemoRenderTarget.

To understand fully the process, here's are two examples using an empty GameObject and a plane GameObject with the SpaceCat demo file. Everything you do will be based on the GameObject you create to load your Harmony data.