Hello Guest

Author Topic: Nested Sprtie Batchers, 2D ToolKit with prefabs.  (Read 3184 times)

Bigcheese

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 19
    • View Profile
Nested Sprtie Batchers, 2D ToolKit with prefabs.
« on: August 14, 2013, 09:54:19 am »
I have a couple of questions,

-Regarding the Sprite Batchers, in case I have nested sprites (as in an StaticBatcher > Empty GameObject > Sprites) building the static batcher is fine, but when trying to edit it, I believe it's does not have references of the nested sprites. this is also problematic in the case of (StaticBatcher > Sprites + StaticBatcher). Is this the intended behavior out of this?

-Also, Saving a sprite (Or nested sprites) as prefabs is fine, but if I try modifying this prefab (As in changing the sprite) it won't revert across other instances of this prefabs, and if I force revert it, the sprite's mesh filter material would disappear. So only the basic components would only work in the prefab (As in scaling, rotating, physics, etc) but the tk2d components won't work properly with it.

I just need some clarifications to what would be the best practices using the 2D toolkit to go about building levels compiled of multiple smaller blocks.

Thanks in advance :)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Nested Sprtie Batchers, 2D ToolKit with prefabs.
« Reply #1 on: August 14, 2013, 01:01:34 pm »
1. The StaticBatcher -> Empty GameObject -> Sprites scenario is a bug. This has been fixed in the next release, but for now:
You can fix it in tk2dStaticSpriteBatcherEditor.cs, right at the end of the function,
Code: [Select]
if (baseSprite != null) {
baseSprite.scale = bs.baseScale;
baseSprite.color = bs.color;
}

2. Nested static batchers aren't supported, and intentionally so. Its far to hard to handle every possible permutation here correctly, and still get the gains of the batcher.

3. This looks like a fairly recent bug - it actually does transfer the data to the children, but doesn't update the meshes. I'll fix it for the next release, but for now, if you press play, reload the scene, etc. it should update.