- Home /
Question by
derrtyones · Aug 28, 2012 at 07:49 PM ·
javascriptguipositionimage
Change image position
Hi,
With a script I am adding an image on screen:
GUI.DrawTexture(new Rect(10,10,40,39), icon);
As you can see the coordinates are 10,10. When a certain condition happens, I want the image to be moved to a different location on screen. How do I change these coordinates?
NOTE: They must move instantly.
Comment
Best Answer
Answer by Apples_mmmmmmmm · Aug 28, 2012 at 07:53 PM
You could use variables in place of the coordinates and then change the variables with whatever condition.
Answer by ScroodgeM · Aug 28, 2012 at 07:54 PM
make a boolean variable stored in class with GUI command and change it when condition happens
if (CertainConditionHappened) { GUI.DrawTexture(new Rect(20,20,40,39), icon); } else { GUI.DrawTexture(new Rect(10,10,40,39), icon); }
Your answer

Follow this Question
Related Questions
Creating a next and previous Tutorial 1 Answer
Setting Scroll View Width GUILayout 1 Answer
How do I change the texture of a Raw image? 0 Answers
Get touch position? 0 Answers