I am trying to rescale an image within the content of a GUI.Window.
The code comes up with an error "Assets/TextAreaBox.js(14,43): BCE0051: Operator '*' cannot be used with a left hand side of type 'int' and a right hand side of type 'Object'.".
#pragma strict
private var BoxWidth = 350;
private var BoxHeight = 400;
var image_1 : Texture2D;
private var maxImageWidth = BoxWidth-50;
private var ImageRatio;
private var NewImageWidth_1 = image_1.width;
private var NewImageHeight_1 = image_1.height;
if(image_1.width > maxImageWidth){
ImageRatio = maxImageWidth / image_1.width;
NewImageWidth_1 = image_1.width * ImageRatio;
NewImageHeight_1 = image_1.height * ImageRatio;
}
↧