Sprite Storing on JSON Based Remote Configs
LionSDK allows storing Sprites in Remote Config services as references. Conversion is handled automatically when the ref: keyword is used with Remote Config keys.
Adding Sprites as Remote Config Values
Reference values should have this format in the main JSON data: ref:[SPRITE_REMOTE_CONFIG_ID]
Using Sprite Reference in JSON Example:
{
"isBoxed": true,
"boxSprite": "ref:ui_chest_01", //Reference for ui_chest_01 remote config value
"openedBoxSprite": "ref:ui_chest_01_opened", //Reference for ui_chest_01_opened remote config value
"Rewards": [
{
"sprite": "ref:ui_icon_coin", //Reference for ui_icon_coin remote config value
"id": "coins",
"amount": 100
}
]
}
In this example, we should create three remote config keys by using ref IDs: ui_chest_01_opened
, ui_chest_01
, ui_icon_coin
. They will automatically converted to sprites by our converter.
Getting sprites individually in the code:
Sprite logo = RemoteConfigsController.GetValue<Sprite>("Icons/sprite",null);
imageComponent.sprite = logo;
Sprites can not be larger than 512 px, and the recommended size is 256 px maximum.
Flag names are case-sensitive.
Don’t use quotes around string-type remote values.
We have 3 options to store sprite data and use values.
Storing Sprites as Base64 String Values on Remote Configs
We store image file and sprite meta data on the Remote Config service. So players download this data from remote config services at application start. (Stores on remote config server)
Storing Sprites in Resources Folder and Referring The File Path
We store sprite under Resources folder in the project and reference the file path. (Stores on local build)
Storing Sprites in the Project and Adding References to Reward Icons Scriptable Object
We store sprite under Assets folder in the project and reference it in Reward Icons with ID. (Stores on local build)
1) Storing Sprites as Base64 String Values on Remote Configs
We use base64:
prefix for base64 string values to store on Remote Configs.
Sample Base64 as a Remote Config Value:
base64:iVBORw0KGgoAAAANSUhEUgAAAbgAAAFVCAYAAACdEPrvAAAgAElEQVR4Aey9B5xkR3Uufj...
Preparing Sprites for Conversion

To be eligible for base64 conversion, sprites must meet specific import settings:
Read/Write must be enabled.
Compression should be set to None.
ETC2 compression is not supported.

Sprites can not be larger than 512 px, and the recommended size is 256 px maximum.
.png?alt=media)
2) Storing Sprites in Resources Folder and Referring The File Path
For referencing a Sprite in Resources folder we use resources:
prefix and then we add path of the file as remote config value.
Assume you have a sprite called sprite.png
inside Assets/Resources/Icons/
.
Using Resources as Remote Config Value Example:
resources:Icons/sprite
Path shouldn't have extension of the file. For example: Assets/Resources/Sprite.png should be resources:Sprite
3) Storing Sprites in the Project and Adding References to Reward Icons Scriptable Object
LionSDK automatically generates RewardIcons.asset
file in the project. You can add a sprite with new unique ID to reference in Remote Configs. For referencing them we use ico:
prefix and unique ID as remote config value.\
RewardIcons.asset path:
Assets/LionStudios/Resources/RewardIcons.asset
Using Ico as Remote Config Value Example:
ico:ui_icon_coin
Last updated