Hello,
tk2dAnimatedSprite img = GetComponent<tk2dAnimatedSprite>();
Texture2D t = (Texture2D)img.Collection.textures[0];
Color[] cs = t.GetPixels();
in this code,
cs.width is Atlas's width (Pixel).
cs.height is Atlas's height (Pixel).
Isn't it? cs is the data for the whole atlas pixels.
Can I know the Rect data for each sprite?
I mean... there are so many sprites in tk2dAnimatedSprite.
I want to know the color data of each sprites.
something like this...
tk2dAnimatedSprite img = GetComponent<tk2dAnimatedSprite>();
Texture2D t = (Texture2D)img.Collection.textures[0];
Color[] cs = t.GetPixels();
for ( int i = x, i < x + rectWidth; i++ ){
for ( int j = y, j < y + rectWidth; j++ ){
print( cs[ y * t.width + x ] );
}
}
But I don't know how to find rectWidth and rectWidth...
Help me please... T.T