x


How to load texture image on a plane (script)?

I kind of figured out the steps:

 my_plane = GameObject.CreatePrimitive(PrimitiveType.Plane);
 my_plane.transform.Rotate(-90,0,0);
 Texture my_img = (Texture)Resources.Load("texture01.png");
 my_plane.renderer.material.mainTexture = my_img;

but it still doesn't work. Note that my image texture01.png is at the root of my project tab/window.

So far I only see a shadowy/dark plane in the background.

EDIT:

I figured out.

The image need to be in the Resources folder. The filename have to be "texture01" rather than "texture01.png".

more ▼

asked Jul 30, 2012 at 07:56 PM

the_scholar gravatar image

the_scholar
101 21 18 21

Can you post your edit as an answer - so we can have it marked as correct?

Jul 30, 2012 at 08:30 PM whydoidoit
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I figured out.

The image need to be in the Resources folder. The filename have to be "texture01" rather than "texture01.png".

more ▼

answered Jul 15, 2013 at 03:46 PM

the_scholar gravatar image

the_scholar
101 21 18 21

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3581

asked: Jul 30, 2012 at 07:56 PM

Seen: 1440 times

Last Updated: Jul 15, 2013 at 03:46 PM