How do you use a spriteatlas in UIToolkit text?

I made a spriteatlasv2 asset out of my individual icon files, and I want them to be embeddable in text.

The instructions in Unity - Manual: Include sprites in text doesn’t work:

Right-click the sprite and select Create > Text > Sprite Asset. This creates a new sprite asset.

I try to create a sprite asset out of the sprite atlas and it just says:

A texture must first be selected in order to create a Sprite Asset.

So in Unity - Manual: Panel Text Settings assets I just found out about this part:

Note: In the current release, you can’t change the default Panel Text Settings for Editor UI.

Is there really no way to do this? Even if I have to use reflection to execute some private method somewhere?

I tried putting a single icon as its own texture atlas (since there doesn’t seem to be a way to use spriteatlas for this) in a Resources folder, but it doesn’t get picked up by the sprite tag as explained in Unity - Manual: Include sprites in text.

Sprite Atlases in Unity are used automatically. So you don’t reference the sprite atlas, you reference the sprites that are packed in the atlas, and that automatically makes the atlas be used whenever the sprite is used.

So when you generate a Sprite Asset that’s referencing sprites, those sprites will be fetched from the atlas at runtime. The order is irrelevant, and you can set the sprite atlas up after you have set up the tmp sprite asset.

And how do you refer to it via the sprite tag? <sprite="assetName" name="spriteName">

It seems to want me to reference an atlas first, before the sprite.

AssetName here would be the texture name - ie the texture that the sprite is a part of. The sprite atlas should never be a part of the asset creation for sprite assets.

The reason things are set up like that is that a texture can be split into several sprites. This is independent of SpriteAtlases - so one texture can contain many sprites, and the sprites from many textures can be combined in a sprite atlas.

This can be confusing if you’re used to thinking of a texture you have made that contains a bunch of sprites as a “sprite atlas”!