Hello Guest

Author Topic: Issue: Sprite Collection Change on Prefab  (Read 5192 times)

firmie

  • Newbie
  • *
  • Posts: 15
    • View Profile
Issue: Sprite Collection Change on Prefab
« on: November 12, 2013, 10:06:06 pm »
Seeing an issue with changing a sprite collection within a prefab. It's inconsistent, I can't get it to repro 100%.

Setup:

* Have a prefab with a tk2dSprite component.
* Place prefab in scene.
* Change the sprite collection on the master prefab.

Issue:
* Notice the sprite is now incorrect in the scene. (Not 100%) Seems to be using the old Collection atlas with tex coords from the new collection.
* Seems to be fixed when you delete the prefab out of the scene and drop the master prefab back into the scene. From then on it seems okay...
* It might also have to do with overriding the scene prefab then changing the master. Again, can't quite get a solid repro.

Issue 2:
* If you change the prefab instance in the scene and hit apply, the master prefab's sprite collection label seems to change correctly, but the sprite shows in the inspector as if it still is using the previous sprite collection.
* It can be fixed by manually changing the sprite collection on the master prefab after the problem has occurred.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Issue: Sprite Collection Change on Prefab
« Reply #1 on: November 12, 2013, 10:48:46 pm »
This was fixed way way back in an early 2D Toolkit 1.x version - I'll look back in the logs - I might have inadvertently broken it. What version of tk2d and unity are you using?

firmie

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Issue: Sprite Collection Change on Prefab
« Reply #2 on: November 12, 2013, 11:09:33 pm »
Well, i was using a version from a week or so ago, but i just updated right after my first post, and am seeing the same issues.

Also, is there a way to check what tk2d Version im currently using from within Unity? Some doc or code within the 2d Toolkit root?

Related Issue:

* I changed the in-scene prefab sprite collection and got an Index out of bounds exception, presumably on the master prefab.

* The collection did seem to update correctly on the master.

* I assume the sprite index in the collection is saved on the sprite and when the sprite collection changes, it keeps all indices in tact. Maybe that index doesn't get changed on the master when applying a change to a new collection from in-scene?


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Issue: Sprite Collection Change on Prefab
« Reply #3 on: November 12, 2013, 11:13:25 pm »
The "2D Toolkit > About" menu gives you the version number.

Why did you create an in scene prefab instance? Its not meant to be created in scene...

firmie

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Issue: Sprite Collection Change on Prefab
« Reply #4 on: November 12, 2013, 11:22:23 pm »

I mean the sprite collection on my in-scene sprite prefab. I don't have a sprite collection by itself in scene.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Issue: Sprite Collection Change on Prefab
« Reply #5 on: November 12, 2013, 11:24:15 pm »
Gothca. What version are you using? Actually what would be better is if you have a simple repro case, email it to support at unikronsofware.com, it'll really reduce the amount of time it'll take to look at it.

firmie

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Issue: Sprite Collection Change on Prefab
« Reply #6 on: November 12, 2013, 11:51:46 pm »
Also sent to Support.

I'm using 2.3.0.

After some more testing, the issue is definitely there.

Here's my current situation that resulted in the issue.

* Have 2 separate sprite collections. I have both made up of multiple 64x64 sprites.
* Have a few of the same sprites in both collections, but the collections should be significantly different other than that. Different sizes as well.
* Create sprite in scene. Set to collection 1 (this is the bigger collection for me) with one of the common sprites.
* Parent it under an empty game object (I don't think this matters) and create a master prefab out of the empty game object.
* Delete the in scene prefab instance and create a new in-scene instance of the prefab from the master.
* Change the master prefab to sprite collection 2, this should retain the same sprite name.

Issue:
* The in-scene sprite will be incorrect. It still appears to be using sprite collection 1 and the texture coordinates are all wrong. They are not even the size of any sprite from collection 1.

Note: This only seems to happen the first time. Once i delete the in-scene prefab and replace it with a new instance of the master, it is correct and doesn’t seem to be a problem even if i change the master after that.