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 your 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.

GameObjects

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.

There is a quick way to import Harmony data:

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 > 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.

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.