Hi every one, I found this little issue (Unity 3.4.2):
var showOnOff : boolean;
var useScreen : boolean;
//
function OnGUI {
//
if (!showOnOff) {
if (GUI.Button(Rect(), "Title Screen")) {
showOnOff = true;
}
}
else {
GUI.Box(Rect(0, 0, useScreen ? Screen.width : 640, useScreen ? Screen.height : 480), "This is the Title");
}
}
When I try to draw a gui box using the screen size the debuger show this:
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.CheckNumericPromotion (IConvertible convertible)
Boo.Lang.Runtime.RuntimeServices.CheckNumericPromotion (System.Object value)
Boo.Lang.Runtime.RuntimeServices.UnboxSingle (System.Object value)
Screen.OnGUI () (at Assets/Screen.js:11)
This is kind of weird because some time before I can use this type of function in my projects (Unity 3.3), even if I try to check the screen resolution using this:
Debug.Log (Screen.currentResolution);
The debuger show this:
Null
UnityEngine.Debug:Log(Object)
How can this be possible!, any help will be appreciated, thanks in advance.