Skip to content

Images

Images are digital assets that can be uploaded to the Content Delivery Network (CDN) via Balancy. These assets are dynamically delivered at runtime, enabling the game to use updated visual content without the need for patching or direct updates. Currently, Balancy supports the uploading of images in PNG and JPEG formats.

Images in Balancy

Adding Images

To use images in your game:

  1. When defining a new parameter, select the object sub-type Image.
  2. You can then insert links to your uploaded images in your documentation.

For Developers

The code generator automatically sets the type for Image parameters as UnnyObject, which includes a method LoadSprite for asynchronous loading. All images are cached locally at PersistanceDataPath to minimize download times and bandwidth usage.

Best Practices

Images are invaluable for adding dynamic content to game offers and the shop interface. They can significantly enhance the game's visual appeal by allowing for the customization of backgrounds, buttons, and other game art remotely. However, managing these assets efficiently is crucial to avoid duplication and bloat:

  1. Avoid Adding Images Manually: Instead of adding images directly to the game, upload them to Balancy.
  2. Use Balancy for All Images: Upload necessary images to Balancy for use in your game.
  3. Flag Important Images: For images that need to be included in the initial game build, such as default buttons and background images, mark them with the Save in Resources flag. This is typically unnecessary for dynamic offers.
  4. Sync with Unity: In Unity, navigate to Tools ► Balancy ► Config and select Download Data to synchronize.
  5. Access Images from Resources: Images marked with the Save in Resources flag can be found under Assets/Balancy/Resources.

Tip: Although images are identified by unique IDs, making direct references less convenient, future updates may introduce name-based referencing for improved ease of use.

  1. Build Prefabs Using Resources: Construct default prefabs for shops and offers using images from the Resources directory.
  2. Avoid Duplicating Images: This method ensures no image duplication within your build while maintaining flexibility for remote updates.
  3. Null Check in Code: When replacing a default image, ensure the new image is not null before assignment to avoid removing default imagery.
myItem.Icon.LoadSprite(sprite =>
{
    if (sprite != null)
        icon.sprite = sprite;
});