Anyone explain to me why this is making my GUI rect not work?
new Rect (0,0,(persistence.sheight / 1.6), persistence.sheight);
The goal is to set up my GUI so that no matter what device it loads on it has some basic screen ratio built in and will stretch the rects to look decent size. The issues seems to be that my (persistence.sheight / 1.6) formula returns a double in the form of a ###.### value that goes out to the 3rd decimal position.
I guess you use C# (guess from the new keyword). You should devide by a float value to get a float value:
new Rect (0,0,(persistence.sheight / 1.6f), persistence.sheight);
However magic numbers inside the code should be avoided. Additionally multiplications are a little bit faster than divisions so i would predefine your factor like this:
// C#
float aspect = 1 / 1.6f;
// [...]
new Rect (0,0,(persistence.sheight * aspect), persistence.sheight);
You need to cast the double return value to a float to use with the rect:
new Rect(0,0,(float)(persistence.sheight/1.6), (float)persistence.sheight);