Hello,
I’m looping though an array of sprites to create a button for it. Every sprite of the spritesheet get’s his own button, i know this is slow so i need to find a work around for this.
Currently i have:
EditorGUILayout.BeginHorizontal();
for (int i = 0; i < tile.sprites.Length; i++)
{
if (i % 5 == 0)
{
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
}
if (GUILayout.Button(TextureFromSprite(tile.sprites*), GUILayout.Width(50), GUILayout.Height(50)))*
{
Debug.Log(tile.sprites*.name);*
}
}
EditorGUILayout.EndHorizontal();
The Texturefromsprite is a method to get the sprite for the button ( it returns the sprite itself)
Thanks in advance!