# Avatar SDK Move — Unity Plugin

Generate humanoid animations from a text prompt and retarget them onto your own humanoid models,
in the Unity Editor or at runtime.

## Requirements

- **Unity 6000.0 or newer**
- **Universal Render Pipeline (URP).** The bundled MetaPerson sample models ship with URP materials and
  will render magenta under the Built-in Render Pipeline. The plugin's scripts do not depend on any
  render pipeline — only the sample materials do.
- An Avatar SDK account, identified by your email address. It is the same account you use in
  [MetaPerson Creator](https://metaperson.avatarsdk.com): signing in with the same email gives you the same
  coin balance in both.

## Pricing

Animation generation is paid in coins: **3 coins per second of animation**, and an animation is 5 to 10
seconds long. The price is shown on the **Generate** button before you start.

- Free animations on your account are used first; a generation that uses one costs nothing.
- With an active Avatar SDK subscription, generation is not charged.
- Coins are bought in MetaPerson Creator. Every **Top Up** button in the plugin opens MetaPerson Creator
  signed in to your account, with the coin shop already open.

Coins are charged when a generation starts. If a generation fails, the plugin shows its animation code;
contact <support@avatarsdk.com> with that code.

## Installation

1. Import the `.unitypackage` into your project (`Assets → Import Package → Custom Package…`).
2. The **Account** window opens automatically when no account is connected.
   You can also open it from `Avatar SDK Move → Account`.
3. Enter your email and press **Send Code**.
4. Enter the one-time code you receive by email and press **Authenticate**.

On success the session is encrypted into `EditorPrefs` on this machine. It is never written into the
project, so it does not end up in source control, in a `.unitypackage`, or in a build. A built player
keeps its own session in `PlayerPrefs` and signs in on its own.

The Account window shows your balance, free animations and subscription, and links to both sample scenes.

## Updates

When Unity starts, the plugin checks whether a newer version is available and, if so, offers to
download it. **Skip This Version** silences the reminder for that version only. You can also check at any
time with `Avatar SDK Move → Check for Updates`.

## Upgrading

**Delete `Assets/itSeez3D/AvatarSDKMove` before importing a newer version.**

Importing a `.unitypackage` over an existing installation adds and overwrites files but never removes
them. Files that were deleted or renamed between versions are left behind, and stale scripts will produce
compile errors. Generated animations live outside the plugin folder, in
`Assets/itSeez3D/AvatarSDKMoveData/`, and are not affected.

## Generating an animation in the Editor

1. `Avatar SDK Move → Animation Generator`
2. Enter a prompt and choose the duration.
3. Press **Generate**. The button shows the price.

Generation runs on the server and takes a few minutes. The animation appears under
**In Progress Animations** with an estimate of the time left, so you can keep working or start another
one. Generations continue on the server even if you close the window.

When an animation is ready, it is imported automatically as a Humanoid FBX into
`Assets/itSeez3D/AvatarSDKMoveData/GeneratedAnimations/<animation code>/`. If Unity was restarted while it
was being generated, it appears under **Completed Animations** instead, ready to import.

**Completed Animations** lists every animation on your account, including those generated in
MetaPerson Creator or in another project. **Import** downloads one into this project; **Show More** loads
older ones.

**Preview Model** is optional. Assign a humanoid model from your scene — it needs an `Animator` with a
Humanoid avatar — and press **Show** on an imported animation to play it on that model. **Create Animator
Controller** builds a controller from the shown clip and assigns it to the Preview Model's `Animator`.
GLB animations generated elsewhere can be imported but not previewed.

If a generation fails, it stays in the list with its animation code and a **Copy Code** button for
contacting support.

## Generating an animation at runtime

See the `RuntimeAnimationGenerationSample` scene. It signs the user in with an email and a one-time
code through the reusable `AccountPanel` prefab, the same way as the Account window. In Play Mode it
reuses the Editor session; a built player asks the user to sign in once. The panel shows the balance and a
**Top Up** button.

The `AnimationGenerator` prefab does the work:

- `StartGeneration(prompt, duration)` pays for and starts a generation and returns its record without
  waiting for it to finish.
- `Play(targetModel, animation)` downloads a completed animation, plays it on the retargeting source
  model, and `HumanoidRetargeter` drives your target model from it.
- `Generate(targetModel, prompt, duration)` does both and waits in between.

Progress, completion and failure are surfaced through `UnityEvent`s so they can be wired to UI in the
Inspector. Runtime animations are requested as GLB and parsed in memory, which is what lets the whole flow
run in a WebGL build.

The sample keeps a history of the account's animations: generations in progress survive restarting the
application, and clicking a completed animation plays it.

## Sample presentation

Both sample scenes use a shared studio layout: a light control panel, a dark preview stage,
three-point lighting, realtime URP shadows, and the included `SampleVolumeProfile` for grading.
`GettingStartedSample` walks through the Editor workflow; `RuntimeAnimationGenerationSample`
includes email sign-in, prompt and duration controls, account balance, and a scrollable motion library.

All presentation assets are included under `Samples/Presentation`. The character material variants use
standard URP shaders; the floor shader uses URP's lighting and shadow APIs. No additional UI, font,
post-processing, or renderer-feature package is required beyond the project's existing Unity UI and URP.
The scenes inherit the host project's URP quality and shadow settings and do not replace its renderer
or modify project settings. Keep URP shadows enabled for the stage's realtime shadows.

The UI scales with the Game view and is designed for landscape windows (960 × 720 and larger).
The sample EventSystem selects the project's enabled input backend automatically; installing the
new Input System is not required when using Unity's legacy input backend.

The original MetaPerson material assets are unchanged. The sample scenes override them with their own
URP material variants, so you can adjust the sample appearance independently of your other scenes.

## Support

<support@avatarsdk.com> — please include the plugin version shown at the bottom of the Account window
and, for a failed generation, its animation code.
