Ok, so my problem here is I am trying to create my own 2D tiling level builder and I need to be able to display in a grid or list of some sort representations of my tiles and sprites. I have this almost figured out now but there is a piece missing and I have tried just about everything I can think of and find on the net. The only way I have found to do this so far is extremely slow process wise and not viable for a workflow environment (involves using GetPixels and SetPixels).
So the way I am doing this is making one selection grid for the Tileset and another for the individual Tiles of that set. like this:
selection = GUILayout.SelectionGrid (selection, tilesetTextures, numTilesets, style1);
UnityEngine.Object[] allSprites = AssetDatabase.LoadAllAssetRepresentationsAtPath(String.Format ("Assets/Resources/Tilesets/{0}{1}", tilesetTextures[selection].name, ".png"));
for(int i = 0; i < tileSprites[selection].Length; i++){
tileSprites[selection][i] = (Sprite)allSprites[i];
tileTextures[selection][i] = tileSprites[selection][i].texture;
}
subselection = GUILayout.SelectionGrid (subselection, tileTextures[selection], numTiles, style2);
The problem with this is that the Sprites’ textures refer back to the ENTIRE spritesheet. I need a way to access the images associated with each individual sprite slice.