1
Support / Re: Randomly instantiating sprites in a sprite collection?
« on: January 05, 2014, 01:19:59 am »Create a prefab of a sprite from the sprite collection, instantiate it and then change the sprite Id using something like this:Code: [Select]int randomSprite = 0;
do {
randomSprite = Random.Range(0, sprite.Collection.Count);
} while (!sprite.Collection.spriteDefinitions[randomSprite].Valid);
sprite.SetSprite( randomSprite);
the while loop is necessary in case you have deleted / invalid sprites in your collection.
I have to say, thank very much for the response! Sorry for the long reply. This helped me out immensely!
