shopWindow = GUI.Window (0, shopWindow, DoMyWindow, “Shop”);
How do I put this function
function ResizeGUI(_rect : Rect) : Rect
{
var FilScreenWidth = _rect.width / 800;
var rectWidth = FilScreenWidth * Screen.width;
var FilScreenHeight = _rect.height / 600;
var rectHeight = FilScreenHeight * Screen.height;
var rectX = (_rect.x / 800) * Screen.width;
var rectY = (_rect.y / 600) * Screen.height;
return Rect(rectX,rectY,rectWidth,rectHeight);
}
Into the window script as I did with buttons:
if (GUI.Button(ResizeGUI(Rect (197,20,105,30)), "")) {
Your ResizeGUI function takes type Rect as a parameter as default values and returns a Rect, so you can supply this function as the rect parameter when using GUI.Window shopWindow = GUI.Window(0, ResizeGUI(shopWindow), DoMyWindow, "Shop");
– Josh707If I do that, it makes it go beserk, resizing every frame and dissapear
– Madswint