Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Printing image on 2D sprite

Discussion in '2D' started by MarkizQmz, Sep 24, 2016.

  1. MarkizQmz

    MarkizQmz

    Joined:
    Sep 24, 2016
    Posts:
    7
    Hey guys, I am new to Unity and I am currently working on a game for Android.

    The concept is the is basically open a chest, and the user gets a random reward (in this case a picture).

    So what I am trying to do is print a random image from a folder on a 2D sprite, but I haven't had much success so far. What would be the best way to go about this if I want to work with that random image after printing it on the sprite?
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I'm not sure what it means to "print" an image on a sprite. But perhaps you're looking for Sprite.Create, giving it a texture you created with Texture2D.LoadImage. (You can read the bytes of the file in using standard C# file I/O.)