x


Find Texture by path in script

I have a texture in the 'project' tab, I want to 'find' it in script:

Texture tex = ??

Is there a way to do this similar to Shader.Find or do I have to attach it to a GameObject and do via the GameObject?

more ▼

asked Nov 24 '10 at 04:07 PM

_Petroz gravatar image

_Petroz
3.5k 27 34 57

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You could use Resources.Load if you put the texture into /Assets/Resources. You then use Resources.Load("RelativePathToTextureFromResources").

more ▼

answered Nov 24 '10 at 04:23 PM

Mike 3 gravatar image

Mike 3
30.5k 10 65 252

(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:

x2193
x206

asked: Nov 24 '10 at 04:07 PM

Seen: 1764 times

Last Updated: Nov 24 '10 at 04:07 PM