I have a simple application that It needs to run for 10 hours per day. Don't ask why!!! I am not a programmer so i am not really aware about what happens with memory management variables or background logs in unity. I have some gui variables like that ... there are loads more to be honest ..
var widthBorderShort = (Screen.width - (Screen.width/20))-512;
var widthBorderLong = (Screen.width - (Screen.width/20))-975;
var heightBorder = (Screen.height -(Screen.height/20))-64;
If i declare the variables in OnGUI and do a debug log the variables are called every frame. How unity is working if i am not using debug log? does it just replaces a few numbers every frame or it keeps a log of them? In around 7 hours the application crashes ! So i must have a memory leak or some sort of logging overflow ... Is there any way to figure out what is going on ? IT might be even a computer problem ...
The ideal would have been to put these variables in an update or onGUI and calculate screen.width ONLY when the user tries to resize. something like
if (application.resize)
{
//find my new screen/width
//dostuff
}
or getting a value from awake naming it initialScreenWidth and
if (Screen.width> intialScreenWidth){
//declare variables
initialScreenWidth= Screen.width;
//do stuff
}
Should i worry about declaring variables OnGUI or there is no problem ... ?I am not sure where to begin really ... any suggestions?