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! :)
Answer by cpp_fanatic
Feb 14, 2011 at 07:38 PM
The simplest way:
Texture2D image = (Texture2D)Resources.Load("image1");
Note the follows:
Draw the image:
GUI.DrawTexture(new Rect(0, 0, image.width, image.height), image);
GUI.DrawTexture and GUITexture are 2 different system !
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
Null reference exception[SOLVED]
reference Gui texture outside script
change bar position
Load an image from www and save it for offline use
Creating a component from a button click