Within Listing 3.3, on page 52, we have the OnGUI() method. Within this method, we define a size for our label, then define two variables for the lower left hand corner of the rectangle we are about to draw, posX and posY, i.e.
void OnGUI() {
int size = 12;
float posX = _camera.pixelWidth/2 - size/4;
float posY = _camera.pixelHeight/2 -size/2;
GUI.Label(new Rect(posX, posY, size, size), "*");
}
Why in posX do we take away size/4 and not size/2? Surely this means that the asterisk in the GUI will be 3 pixels skewed to the right off center?
Thanks.
|