I need to change the sprite
property of a SpriteRenderer
component programmatically. The Sprite.Create()
function takes a Texture2D
object, which is the sprite image. I have a sprite sheet that is split into sprites automatically by Unity. How do I make a Texture2D
object from one of these sprites?
Just use
sprite.texture