I have a whiteboard object that I would like to put images/pdfs/powerpoints on. I am not sure how to overlay an image on a white shader. I looked at this post:

Loading .PNG file and using it for UnityEngine.UI.Image

But I am not sure where to put the UI.Image. If I create a mesh from the image won't it cover up my entire whiteboard?

  • \$\begingroup\$ Instead of putting all of that onto one mesh, it might be much easier to make each image/etc. to be their own object. You can just drag a .png file onto the scene view and it will make an object. You can take it from there. \$\endgroup\$
    – Daniel
    Sep 26, 2015 at 6:26
  • \$\begingroup\$ @Daniel okay. How do I add the .png file programatically? \$\endgroup\$ Sep 26, 2015 at 16:14

1 Answer 1


To reply to your comment:

First of all you are going to have to make your image into a prefab. This can be easily done by dragging the image file from the assets folder onto the scene view, then drag the newly made object back into the assets folder. (Delete the object in the scene if you want)

Now in order for the prefab to be able to accessed, you will have to create a new folder in your assets folder called "Resources". Put the GameObject prefab into this folder.

After that is done this code should do the trick:

private GameObject image;

public void Start() {
    image = (GameObject)Resources.Load("Image1");

public void AddImage() {
    Vector3 spawnPosition = new Vector3(0, 2, 0);
    Quaternion spawnAngle = Quaternion.Euler(0, 0, 0);
    Instantiate(image, spawnPosition, spawnAngle);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .