1
Support / Re: General question regarding static sprite batching
« on: February 14, 2013, 02:41:53 am »
I don't really understand what do you mean by commit, since I'm creating the static sprite batch programmatically. I did call the build function though. Just in case, here's the snippet of my code in question:
I've done a quick check and there is no commit function for tk2dStaticSpriteBatcher... or am I looking in the wrong place?
Code: [Select]
tk2dSpriteCollectionData scd = (tk2dSpriteCollectionData) Resources.Load("BGCollection", typeof(tk2dSpriteCollectionData));
GameObject spriteBatcherGO = new GameObject("BGSpriteBatcher");
tk2dStaticSpriteBatcher staticSB = spriteBatcherGO.AddComponent<tk2dStaticSpriteBatcher>();
staticSB.spriteCollection = scd;
spriteBatcherGO.transform.parent = transform;
tk2dBatchedSprite[] batchedSpriteList = new tk2dBatchedSprite[noOfRows * noPerRow];
int index = 0;
for (int i = 0; i < noOfRows; ++i)
{
currentHeight = startHeight + i * spriteHeight;
for (int j = 0; j < noPerRow; ++j)
{
tk2dBatchedSprite batchedSprite = new tk2dBatchedSprite();
batchedSprite.spriteId = 0;
batchedSprite.position = new Vector3((i % 2 == 0)?widthArray[j]:widthOddArray[j], currentHeight, tempZ);
batchedSprite.color = _color;
batchedSpriteList[index] = batchedSprite;
++index;
}
}
staticSB.batchedSprites = batchedSpriteList;
staticSB.Build();
I've done a quick check and there is no commit function for tk2dStaticSpriteBatcher... or am I looking in the wrong place?