Before updating to Windows 10 you may need to return your Pro license. More information here

How to do you add GUI texture using a script?and position it to the left (regardless of the reso.)

I have searched in and find out how to add it by selecting a texture and heading up to gameobject>creat other>GUI TEXTURE..But how can i do it on script? and if possible to have it positioned in the left part regardless of the Screen resolution.

I hope you can help me out! :)

more ▼

asked Feb 13, 2011 at 10:46 PM

avatar image

futureseeker 1
129 56 42 48

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

1 answer: sort voted first


The simplest way:

Texture2D image = (Texture2D)Resources.Load("image1");

Note the follows:

  1. You should put the file called "image1.png" into the Resources folder in your project folder. Calling the Load method you should not specify the extension of your file.
  2. You can have subfolders in the Resources folder.

Link: http://unity3d.com/support/documentation/ScriptReference/Resources.html

Draw the image:

GUI.DrawTexture(new Rect(0, 0, image.width, image.height), image);

more ▼

answered Feb 14, 2011 at 07:38 PM

avatar image

47 13 10 16

GUI.DrawTexture and GUITexture are 2 different system !

Mar 06, 2014 at 06:20 AM raptorkwok
(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



Answers and Comments



asked: Feb 13, 2011 at 10:46 PM

Seen: 8863 times

Last Updated: Mar 06, 2014 at 06:20 AM