2D Toolkit Forum

2D Toolkit => Support => Topic started by: fryza on March 12, 2014, 11:04:16 pm

Title: Possible Sprite ID Bug
Post by: fryza on March 12, 2014, 11:04:16 pm
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:
Quote
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.

(https://dl.dropboxusercontent.com/u/109152337/problem.png)
Title: Re: Possible Sprite ID Bug
Post by: unikronsoftware on March 12, 2014, 11:13:17 pm
Its like its not updated the mesh / material. I can't see why. Can you create a simple repro case for this? That will make this a whole lot easier to track down. I am not aware of any bug like this.
Title: Re: Possible Sprite ID Bug
Post by: fryza on March 12, 2014, 11:23:11 pm
So here is this specific instance of steps:

Title: Re: Possible Sprite ID Bug
Post by: unikronsoftware on March 12, 2014, 11:45:55 pm
This may well be a bug. I'll investigate.
Have you tried SetSprite(newCollection, newSprite) ?
Title: Re: Possible Sprite ID Bug
Post by: fryza on March 12, 2014, 11:59:17 pm
That fixed it!!! Looks like its probably a bug!