Author Topic: Screenshots to UISprite  (Read 1949 times)

Tatanan

  • Jr. Member
  • **
  • Thank You
  • -Given: 11
  • -Receive: 0
  • Posts: 81
    • View Profile
    • Casual Arena
Screenshots to UISprite
« 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.
Game developer on Casual Arena.

Leopotam

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 7
    • View Profile
Re: Screenshots to UISprite
« Reply #1 on: July 01, 2015, 05:59:22 AM »
You cant, use UITexture instead.

Tatanan

  • Jr. Member
  • **
  • Thank You
  • -Given: 11
  • -Receive: 0
  • Posts: 81
    • View Profile
    • Casual Arena
Re: Screenshots to UISprite
« Reply #2 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.
Game developer on Casual Arena.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Screenshots to UISprite
« Reply #3 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.