AudioAsset
Ease
FastString
FontAsset
NineSlice
PackedSprite
PackedSpriteID
RB
   HardwareSettings
   IRetroBlitGame
RBAsset
Rect2i
ShaderAsset
SoundReference
SpriteGrid
SpriteSheetAsset
TMXMapAsset
   TMXLayer
   TMXLayerLoadState
   TMXObject
   TMXObjectGroup
   TMXProperties
Vector2i

RB.PackedSpriteID

Method  -  Static

public static PackedSpriteID PackedSpriteID(string name)
public static PackedSpriteID PackedSpriteID(FastString name)

Parameters

name string Packed sprite name, which corresponds to the filename (without extension) of the source sprite before it was packed into the sprite pack.

Returns

PackedSpriteID

Packed sprite id

Description

A helper function for getting a PackedSpriteID from a string. These ids can then be used for drawing sprites from sprite packs with RB.DrawSprite. PackedSpriteID is more efficient to use than a string or even a FastString.

PackedSpriteID is independent of any particular sprite pack. If multiple sprite packs contain sprites with the same names the same PackedSpriteID can be reused.

RB.PackedSpriteID is stable across sessions, and all devices. The same string or FastString will always result in the same PackedSpriteID. Therefore, it is safe to persist and reuse these ids if needed.

See Demo Reel for example usage of sprite packs.

Example

PackedSpriteID heroSprite;

void Initialize() {
    heroSprite = PackedSpriteID("characters/hero_idle");
}

void Render() {
   RB.DrawSprite(heroSprite, pos);
}

See Also

RB.DrawSprite
SpriteSheetAsset
PackedSpriteID

See Docs

Features - Sprite Packs
Features - Drawing