Hi,
Im using UnityEdtior to get sliced sprites from a texture 2D. This texture is a tileset and each tile is used to build like a RPG map. I sliced all texture on Sprite Editor from Unity. The code below works properly and take me a sprites array, however it cannot be used to compile for mobiles because UnityEditor codes cannot be package.
//texture is an instance of Texture2D
var texturePath = UnityEditor.AssetDatabase.GetAssetPath(texture);
//get all generated sprites from a sliced textured.
var sprites = UnityEditor.AssetDatabase.LoadAllAssetsAtPath(texturePath).OfType<Sprite>().ToArray();
How can I accomplish it without have to use UnityEditor? I need it to build maps on the fly.
Thanks!