2D Toolkit Forum

2D Toolkit => Support => Topic started by: Christamin on November 07, 2012, 03:04:45 am

Title: Expensive Operation? 0.o
Post by: Christamin on November 07, 2012, 03:04:45 am
So let's just say I'm making an iPhone game,
If I were to to change the sprite id like this: sprite.spriteId = sprite.GetSpriteIdByName("PlatformSmall"); pretty often,
would this hinder the performance substantially?
Title: Re: Expensive Operation? 0.o
Post by: unikronsoftware on November 08, 2012, 10:01:28 am
Not massively, but you can always just cache the value and use it. Its just a couple lines more :)

Code: [Select]
int platformSmallSPriteId;
platformSmallSPriteId = sprite.GetSpriteIdByName("PlatformSmall");

...
sprite.spriteId = platformSmallSpriteId