Hello Guest

Author Topic: Bug? Multiple materials for sprite collection is not working.  (Read 3256 times)

Benny

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Bug? Multiple materials for sprite collection is not working.
« on: November 21, 2013, 01:41:19 pm »
After I updated to 2.6.0, multiple materials for a single sprite collection is not working. When hitting 'commit' to generate sprites data, all material indices of sprites will be reset to 0.

So I traced down to source code of tk2d, and found something weird.

File: tk2dSpriteCollectionBuilder.cs
Line: 1910

Code: [Select]
// make sure its not overrun, can happen when refs are cleared
thisTexParam.materialId = Mathf.Min( thisTexParam.materialId, gen.atlasMaterials.Length - 1);
coll.spriteDefinitions[i].material = gen.altMaterials[thisTexParam.materialId];
coll.spriteDefinitions[i].materialId = thisTexParam.materialId;

First line uses altlasMaterial to clamp material id, I suppose this is what is causing the bug. I changed it to altMaterials, and it seems back to work.

Am I correct?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Bug? Multiple materials for sprite collection is not working.
« Reply #1 on: November 21, 2013, 02:07:57 pm »
Yes it is, sorry I haven't got around to issuing a fix yet. I'm waiting on one last fix before I do that.
http://2dtoolkit.com/forum/index.php/topic,3092.0.html