# 🤖 Conversion Features and CI/CD

[← Back to documentation index](<https://cri-middleware.github.io/SSPlayerForUnity/index.md>)

This document summarizes the import-time optimizations, batch conversion features, and CI/CD integration related to converting `.sspj` to `.ssab`.

For the basic import procedure, see [Asset Import and Editor Integration](<https://cri-middleware.github.io/SSPlayerForUnity/workflow/usage_asset_pipeline/index.md>).

## Configuring the output location

The output location for conversion results is set via **Output Folder** in the SS Importer window (default: `Assets/ssab_generated`); any folder under `Assets/` will do — drag a folder from the Project window onto the field (or pick one with the circle button); **Reset** returns to `Assets/ssab_generated`. Anything else — a file, or a folder outside `Assets/` — is refused with the reason, and the field goes back to the folder the next import will actually use. The setting is saved in `EditorUserSettings` (`UserSettings/EditorUserSettings.asset`), so it is per project and per person.

## Automatic configuration on import into Unity (textures and materials)

When an optimized binary (`.ssab`) to be used in Unity is added to the project, the internal `AssetPostprocessor` detects it and automatically applies the following asset settings.

This automatic configuration works correctly in both cases: **when the file was converted and output from the SS Importer window**, and **when a `.ssab` already converted by an external tool such as `ssconverter-cli` is manually copied (imported) into the Unity project**.

- **Texture import settings**: For textures (image files) in the same folder as the `.ssab`, optimal import settings for 2D animation (uncompressed, Clamp, Mipmap disabled, alpha transparency, etc.) are applied automatically. They are applied the first time Unity imports a texture, and only if a `.ssab` or `.sspj` is already in its folder at that moment: copy the textures in **together with** their `.ssab`, not before it. Textures that came in first keep Unity's defaults (compressed, mipmaps on, Repeat); set them in the Inspector by hand.
- **Automatic shared material generation**: A single `.mat` file corresponding to each texture referenced by the `.ssab` is automatically generated adjacent to the texture.

## Batch conversion of folders

Dropping a **folder** into the drop area of the SS Importer window (Unity menu: **Window \> SpriteStudio \> Importer**) **recursively batch-converts** the `.sspj` files within it **to `.ssab`**. Dropping multiple files at once is also supported.

## Reflecting animation changes (re-conversion)

When you modify an animation on the SpriteStudio side, there are several ways to reload the latest `.sspj` and update (re-convert) the `.ssab` in Unity.

- **Inspector**: You can run it from the **Reconvert** button in the `SpriteStudioAnimeAsset` inspector, or from the same button under **Anime Asset** in a `SpriteStudioPlayer` / `SpriteStudioGraphic` inspector. It writes back into the folder that asset is in, so it still lands in the right place after you have moved or renamed the folder.
- **Project browser right-click**: **SpriteStudio \> Reconvert** on one or more `.ssab` does the same for each of them.
- **Recent list in the SS Importer window**: Clicking a row triggers re-conversion. You can also run it from **Reconvert** in the right-click menu. These start from the `.sspj`, so they write into **Output Folder**, exactly as a fresh drop would.

## Notes

- **We recommend managing `.sspj` outside the Unity project (e.g., outside the repository).** By dropping it onto the SS Importer window, only the conversion result (`.ssab`) is generated in the output location (Output Folder) within the Unity project. This lets you operate without including source data that the game does not need in the Unity project.

---

## For CI/CD: Converting with the SDK CLI

If you want to convert from the command line without launching the Unity editor (e.g., integration into CI/CD or build pipelines, or batch conversion of large numbers of assets), you can use the standalone command-line converter bundled with the SpriteStudio-SDK. It is the same engine, `libssconverter`, that the editor's built-in importer uses behind the scenes.

1. Get the CLI converter for your platform (Windows / macOS / Linux) from [SpriteStudio-SDK Releases](<https://github.com/cri-middleware/SpriteStudio-SDK/releases>).
2. Open a terminal (or command prompt) and run it, passing the path to the `.sspj` file as an argument.

   **Windows:**

   ```powershell
   .\ssconverter-cli.exe path\to\your.sspj
   ```

   **macOS / Linux:**

   ```bash
   ./ssconverter-cli path/to/your.sspj
   ```

   When run, a folder named `<sspj name>/` is created in the same directory as the original `.sspj`, and the `.ssab` (and `.ssqb`) along with image files are output beneath it.

   Run it without `-e` / `--embedded`: this player reads the default output, where the images stay as separate files next to the `.ssab`.
3. Place the **entire `<sspj name>/` folder** under the `Assets/` directory of the Unity project. It is then automatically imported as a `SpriteStudioAnimeAsset`, and the automatic texture and material configuration described above is performed the same way.

For detailed options and specifications, refer to the [`ssconverter-cli` README](<https://github.com/cri-middleware/SpriteStudio-SDK/blob/HEAD/cli/README.md>) in the SDK repository.
