Hi there,
I've created a feature request for this here:
https://moodkie.com/forum/viewtopic.php ... 5118#p5118
However, please be aware that such an implementation would be non-trivial, and we've not encountered any other users who have required this feature yet, so I cannot give an estimate on when this feature would be included.
In the meantime the other alternative would be to create your own list of references to Sprites, and save indices into this list. For example:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpriteManager : MonoBehaviour
{
// Drag your Sprites into this array in the Editor.
public Sprite[] sprites;
public void SaveSpriteArray(string key, Sprite[] sprites)
{
ES3.Save<int[]> (key, GetIndexes(sprites));
}
public Sprite[] LoadSpriteArray(string key)
{
return GetSprites(ES3.Load<int[]>(key, new Sprite[0]));
}
// Get the index of a single sprite.
private int GetIndex(Sprite sprite)
{
for(int i=0; i<sprites.Length; i++)
if (sprites == sprite)
return i;
Debug.LogError("Sprite "+sprite.name+" does not exist in sprite manager");
return -1;
}
// Get the indices for an array of Sprites.
private int[] GetIndexes(Sprite[] spriteArray)
{
var indices = new int[spriteArray.Length];
for(int i = 0; i < spriteArray.Length; i++)
indices = GetIndex(spriteArray );
return indices;
}
// Gets the Sprite for an index.
private Sprite GetSprite(int index)
{
return sprites[index];
}
// Gets the Sprites for an array of indices.
private Sprite[] GetSprites(int[] indices)
{
var spriteArray = new Sprite[indices.Length];
for(int i = 0; i < spriteArray.Length; i++)
spriteArray = GetSprite(indices);
return spriteArray;
}
}
You would then put your Sprites into the sprites array in the Editor and use it's SaveSpriteArray and LoadSpriteArray methods to save and load your sprites.
If you did not want to manually put in a manager for each scene, you could create a prefab in a Resources folder with this Component, and load this prefab from Resources to access the manager.
All the best,
Joel