I have found, using Unity Pro 4.6.1f1 and Windows 7 64, Sprite.Rect is executed really slow when source rect width and height is equal or grather than 32. This is not happening with free version of Unity.
Executing the code below, for values between 16 and 31 inclusive, the execution time is almost 0. But for 32 and above this time is increased to 0.46 seconds.
Is there any way to fix this?
void _debug(int n, string tilesetName, int tileWidth, int tileHeight)
{
float startTime = Time.realtimeSinceStartup;
Rect rec = new Rect(0, 0, tileWidth, tileHeight);
for( int i=0; i < n; ++i )
{
Sprite tileSpr = Sprite.Create(TilesetsAtlasTexture, rec, Vector2.zero);
}
float endTime = Time.realtimeSinceStartup;
float timeElapsed = (endTime - startTime);
Debug.Log(tilesetName + " time " + timeElapsed);
}
private void _GenerateTilesetSprites()
{
for( int n = 16; n <= 36; ++n )
{
_debug(16, n+"X"+n, n, n);
}
}