<div style="padding:15px 15px 2px 20px; border-radius:2px; margin-bottom:20px; border:1px solid #ddd">

<callout>
<p style="margin-bottom:0.75em"><b>Licensing</b></p>!!
A Spine license is [required](/git/spine-runtimes/spine-unity#licensing) to integrate the Spine Runtimes into your applications.
</callout>

<div style="font-size: 1.6em; margin: 0 0 .5em;">spine-unity Runtime Documentation</div>!!
* [Installation](/spine-unity-installation)
* [Examples](/spine-unity-examples)
* [Assets](/spine-unity-assets)
* [Main Components](/spine-unity-main-components)
* [Utility Components](/spine-unity-utility-components)
* [Rendering](/spine-unity-rendering)
* [Timeline Extension UPM Package](/spine-unity-timeline)
* [On-Demand Loading Extension UPM Packages](/spine-unity-on-demand-loading)
* [FAQ](/spine-unity-faq)
</div>!!

# On-Demand Loading UPM Packages

## Why On-Demand Loading

Your project may require many skins and atlas page textures per skeleton where only a fraction needs to be loaded up front. Note that all atlas textures are indirectly referenced by the [SkeletonDataAsset](/spine-unity-assets#SkeletonDataAsset), and are therefore loaded when the skeleton is loaded. This follows standard Unity loading behavior.

To optimize memory usage and application download size, textures can be loaded dynamically at runtime using the on-demand loading UPM packages below.
They allow integration with systems like [Unity Addressables](https://learn.unity.com/course/get-started-with-addressables) to download high-resolution atlas textures only when a corresponding skin is assigned. This reduces initial load size at the cost of small runtime loading delays.

## UPM Packages

On-Demand Loading in spine-unity is supported through separate Unity Package Manager (UPM) extension packages. Two UPM packages are currently available:

* [Addressables UPM Package](#Addressables-Extension-UPM-Package) `com.esotericsoftware.spine.addressables`  
    A ready-to-use implementation based on [Unity Addressables](https://learn.unity.com/course/get-started-with-addressables).
* [On-Demand Loading UPM Package](#On-Demand-Loading-Extension-UPM-Package) `com.esotericsoftware.spine.on-demand-loading`  
    A generic infrastructure package for implementing on-demand loading.

# Addressables UPM Package

The Spine Addressables plugin adds support for on-demand texture loading to the spine-unity runtime through integration with the [Unity Addressables](https://learn.unity.com/course/get-started-with-addressables) system.

This module covers all necessary steps to automatically replace your textures with low-resolution placeholder versions and loads high-resolution textures on demand. A pre-build step replaces the textures in the build output with their low-resolution counterparts, while a post-build step restores the original high-resolution textures in your project. No additional coding is required.

## Installation

The Spine Addressables Extensions package `com.esotericsoftware.spine.addressables` depends on the Spine On-Demand Loading Extension package `com.esotericsoftware.spine.on-demand-loading`. Please install the On-Demand Loading package before installing the Addressables package.

See section [Optional Extension UPM Packages](/spine-unity-installation#Optional-Extension-UPM-Packages) on how to download and install UPM packages and section [Updating an Extension UPM Package](/spine-unity-installation#Updating-an-Extension-UPM-Package) on how to update them.

## Usage

The following steps are all that is required to configure your textures to be replaced with low-resolution placeholders and high-resolution versions loaded automatically on demand.

1. Declare your original high-resolution target Material textures as [addressable](https://learn.unity.com/course/get-started-with-addressables).

![](/img/spine-runtimes-guide/spine-unity/on-demand-loading/set-texture-addressable.png)  

2. Select the `SpineAtlasAsset`, right-click the `SpineAtlasAsset` Inspector heading and select `Add Addressables Loader`.  

![](/img/spine-runtimes-guide/spine-unity/on-demand-loading/add-addressable-loader.png)  

3. This generates an `AddressableTextureLoader` asset.

![](/img/spine-runtimes-guide/spine-unity/on-demand-loading/addressable-asset-created.png)  

4. This asset provides configuration parameters and sets up low-resolution placeholder textures which are automatically assigned in a pre-build step when building your game executable.

![](/img/spine-runtimes-guide/spine-unity/on-demand-loading/addressable-asset-inspector.png)  

5. Build your Addressables content as usual.

From now on when building your game executable, the low resolution placeholder textures are automatically assigned initially and the corresponding high-resolution textures loaded on-demand.

## Editor Preview

Please note that the low-resolution textures are only activated during the game build process. They are not visible in the Unity Editor, including during play mode.

If you'd like to preview the behavior with low-resolution placeholders in the Editor, you can temporarily assign them for testing. To do this, select the desired `AddressableTextureLoader` asset and hit `Testing` - `Assign Placeholders` to temporarily replace the high-resolution textures with their low-resolution placeholders.  

![](/img/spine-runtimes-guide/spine-unity/on-demand-loading/placeholders.png)  

You can then observe the high-resolution textures being loaded on-demand during play-mode. Note that this change is for preview purposes only and has no effect on the built game executable. There is no need to manually assign placeholder textures for builds - the system handles this automatically through a pre-build step, with the original textures restored in a post-build step.

# On-Demand Loading UPM Package

The core infrastructure for on-demand loading of atlas textures is provided by the separate  
Spine On-Demand Loading Extension package `com.esotericsoftware.spine.on-demand-loading`.
The Spine Addressables plugin (`com.esotericsoftware.spine.addressables`) builds upon this foundation and provides a concrete implementation based on the Unity Addressables system.

See section [Optional Extension UPM Packages](/spine-unity-installation#Optional-Extension-UPM-Packages) on how to download and install this package and section [Updating an Extension UPM Package](/spine-unity-installation#Updating-an-Extension-UPM-Package) on how to update it.

You can create custom loading implementations by deriving from [`GenericOnDemandTextureLoader`](git/spine-runtimes/tree/spine-unity/Modules/com.esotericsoftware.spine.on-demand-loading/Runtime/GenericOnDemandTextureLoader.cs) and implementing any abstract methods. The [`AddressablesTextureLoader`](git/spine-runtimes/tree/spine-unity/Modules/com.esotericsoftware.spine.addressables/Runtime/AddressablesTextureLoader.cs) class can be used as a reference. If `GenericOnDemandTextureLoader` is not a good fit, you can go one step further and derive your own class from [`OnDemandTextureLoader`](git/spine-runtimes/tree/spine-unity/Assets/Spine/Runtime/spine-unity/Asset%20Types/OnDemandTextureLoader.cs) and provide a fully custom implementation. This allows for alternative loading strategies tailored to specific project requirements.

[Next: FAQ](/spine-unity-faq)
[Previous: Timeline UPM Package](/spine-unity-timeline)
