I have a sprite collection of thumbnail images. I then have 3 different sprite collections that together contain those same thumbnails, but as full size images.
When you select a thumbnail we need to get the same full size version. So I do this:
foreach (tk2dSpriteCollectionData data in currentTheme.SpriteCollections)
{
for (int x = 0; x < data.Count; x++)
{
string sName = data.spriteDefinitions[ x ].name;
if (sName == spriteName)
{ //etc, etc
What we do is cycle through the sprite collections for that "group" of sprites and if we find the same named sprite lets do something with it.
The problem I'm having is on the sprites that have the ID of 0. What happens is "hat_sprite1" in collection 1 has an ID of 0, and instead of showing the hat sprite, it shows the sprite of collection 2 with ID 0.
I cannot figure out any way around this. I'm not even using IDs - just doing sprite.name comparisons.
Any ideas on how to get around this? Notice in the attached image that the sprite collection at the right is showing the proper hat image - but the one that actually shows in the viewport is a shirt.