Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Tatanan on June 30, 2015, 10:27:16 AM

Title: Screenshots to UISprite
Post by: Tatanan on June 30, 2015, 10:27:16 AM
Hello.
Using
  1. Texture2D tex = new Texture2D(128, 128);
  2. tex.ReadPixels(new Rect(0, 0, 128, 128), 0, 0);
  3. tex.Apply();
I can take a screenshot. How can I put it in a UI Sprite?
I guess it should be a UI 2D Sprite, right?

Thank you.
Title: Re: Screenshots to UISprite
Post by: Leopotam on July 01, 2015, 05:59:22 AM
You cant, use UITexture instead.
Title: Re: Screenshots to UISprite
Post by: Tatanan on July 01, 2015, 06:11:08 AM
Isn't it the same as a UI2D Sprite?
On both I just drag a png and it's done.
Title: Re: Screenshots to UISprite
Post by: ArenMook on July 02, 2015, 08:55:45 PM
UI2DSprite works with Unity's 2D sprites. It's not the same thing as a texture. Sprites are packed into atlases at run-time / build time by Unity.