<aside> ⚠️ This sample is conditionally compiled, and only be fully functional if com.unity.addressables package is installed.

</aside>

In Runtime Sprite Change we covered loading sprite with Resources.Load(), but also its possible to use Addressables package to load sdf sprites.

Editor view

Editor view

Decoupled pipeline

Decoupled pipeline designed mainly to allow for this kind of loading, with Resources or Addressables. That means in this section we will be loading SDFSpriteMetadataAsset’s from SDFAsset’s.

In unity 2023 it possible to load sprites from regular pipeline too, mentioned below.

Load Addressable At Path

This button will use Addressable Path string to load “space_SDF.sdfasset” sprite.

Untitled

<aside> 💡 Advantages of loading by path is that you don’t need to relay on serialized unity references. Useful if path to your icons comes from remote config file, for example, or you build addressables from other project.

</aside>

Load Addressables Reference

This button is exactly the same, except it loads asset referenced with serialized AssetReferenceT<SDFSpriteMetadataAsset>- more reliable way to reference asset, since it don’t care about addressable path and that it might change.

Untitled

Process is pretty much the same as previously

Regular pipeline