I'm using Unity 4.6, and I've made a sprite like this:
AtlasFrameData frame = _testAtlas.GetFrameByIndex(0);
Rect spriteRect = new Rect(frame.Position.x, frame.Position.y, frame.FrameSize.x, frame.FrameSize.y);
Sprite _theSprite = Sprite.Create(_testAtlas.AtlasTexture, spriteRect, new Vector2(0, 0));
The texture is an atlas, and I have a bunch of data read in from an XML file telling me where the frames are. I want to do this in Update():
AtlasFrameData frame = _testAtlas.GetFrameByIndex(_currentFrame);
Rect spriteRect = new Rect(frame.Position.x, frame.Position.y, frame.FrameSize.x, frame.FrameSize.y);
_theSprite.textureRect = spriteRect;
But I'm unable to do this since .textureRect is readonly. I could create a new Sprite each frame, but I suspect this is not going to perform well with tons of Sprites.