hi, just started workin on an idea, and i noticed something strange about the way the Rects are drawn out in unity. If anyone could gimme a hand and let me know why there is an incremented value on the width of the region that is drawn, based on how far across or how high the mouse poisition is when the drawing begins. I was expecting the region to begin drawing where i click, it does, and end the rect where i let go. But thats not whats happening at all. Thanks in advance.
var mouseStart : Vector3;
var mouseEnd : Vector3;
var myRect : Rect;
var startDraw : boolean = false;
function Update () {
if(Input.GetMouseButton(0) !startDraw){
startDraw = true;
mouseStart = Vector3(Input.mousePosition.x, Input.mousePosition.y, 0);
}
if(startDraw){
mouseEnd = Vector3(Input.mousePosition.x, Input.mousePosition.y, 0);
if(Input.GetMouseButtonUp(0)){
startDraw = false;
}
myRect = Rect(mouseStart.x, Screen.height - mouseStart.y, mouseEnd.x, Screen.height - mouseEnd.y);
}
}
function OnGUI(){
GUI.Box(myRect, "");
}