Logo

Background Database

ScriptableObject asset for managing loading screen background images

Overview

Background Database is a ScriptableObject that holds a list of sprites to cycle as the loading screen's background. Backgrounds fade (and optionally slide) in and out according to the backgroundAnimation settings on the LoadingScreen component.

Keeping backgrounds in a separate asset means you can swap artwork, create per-level variants, or share the same database across multiple loading screen prefabs without touching the prefab itself.


Creating a Database

Right-click in the Project window

Select Create -> Evo -> Loader -> Background Database

Add your sprites to the Backgrounds list

Assign the asset to the Background Database field on your loading screens


Properties

NameTypeDescription
selectionModeContentSelectionModeHow the next background is picked from the list.
backgroundsList<Sprite>The sprites to cycle through.

Using Multiple Databases

You can assign different databases to different loading screen prefabs — for example, a boss encounter screen with thematic artwork versus a generic level transition. Because databases are ScriptableObjects, they can be shared, duplicated, and edited independently.


Code Example

BackgroundDatabaseExample.cs
using Evo.Loader;
using UnityEngine;

public class BackgroundDatabaseExample : MonoBehaviour
{
    public BackgroundDatabase backgrounds;

    void Start()
    {
        // Add a background at runtime.
        // To avoid modifying the source asset, work on a cloned instance.
        BackgroundDatabase runtimeDB = Instantiate(backgrounds);

        Sprite newBg = Resources.Load<Sprite>("Backgrounds/Forest");
        if (newBg != null)
        {
            runtimeDB.backgrounds.Add(newBg);
        }
    }
}

Modifying a ScriptableObject asset directly at runtime persists across sessions in the Editor. Use Instantiate(database) to create a runtime clone if you need to add entries dynamically without affecting the source asset.


On this page