- Home /
This question was
closed Feb 28, 2014 at 07:46 AM by
Chimera3D.
C# Using Variables for GUI Rectangles
In Unityscript I never had a problem doing something like this:
var screeenPosition : Vector2;
function OnGUI () {
GUI.Label (Rect(screenPosition.x, screenPosition.y, 200, 100), "Hello World");
}
or this:
var labelRectangle : Rect = (0,0, 100, 200);
function OnGUI () {
GUI.Label (labelRectangle, "Hello World");
}
However, in C# I cannot use variables in the rectangles of the GUI.x functions like this, it runs but it doesn't display anything, at all. Only constants in the rectangle parameters work. Help?
Comment
After copying my code while editing my post I saw that my rectangle variable position was set way outside of the screen area :P.
Follow this Question
Related Questions
how to scale and position guiText in android 1 Answer
GUI To change with screen resolution? 2 Answers
How to change Main Camera size and position via code? 2 Answers
Infinite GUI Button positions. 3 Answers
GUI item with object position+dimensions 0 Answers