Hi everyone, I'd like to have access to all the images in a sprite in my code. How can I do this? I wish I could like define a sprite variable and use it like aSprite[imageNumber]. Thanks.
Well a sprite can only have one image. If you are talking about a GameObject with many sprite children, then it is possible. Code (csharp): transform.Find ("spriteName").gameObject.GetComponent<SpriteRenderer>(); If you had say a bunch of sprite children, labeled sprite0 to sprite99 then you could get them into an array: Code (csharp): List<SpriteRenderer>sprites; for (int i = 0; i < 100; i++) { SpriteRenderer spr = transform.Find ("sprite" + i).gameObject.GetComponent<SpriteRenderer>(); sprites.add(spr); } Then you could access them in the manor you were hoping for.