Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

How do I get a Texture2D from a SpriteManager2 Sprite Atlas

$
0
0
I have a PackedSprite object created with SpriteManager2 with several animations. I would like to use a particular frame of one of these animations as the texture for another object related to this sprite. I could create a separate Texture2D from the source image, but since I already have that image as part of this sprite's texture atlas, it seems like a waste to have to also keep a second copy of that image in memory for this texture. I can access the sprite's material and the uv coordinates of the texture in question with: //Using {} because I can't type angle brackets in a question Material material = sprite.GetComponent{MeshRenderer}().material; Rect uvRect = sprite.GetAnim("animName").GetFrame(frameIndex).uvs; But I can't figure out how to get from here to a Texture2D. Can anybody help shed some light on this? Thanks!

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>