I have an array with 200 elements that have to be placed on the GUI layer once. After that, sometimes I will have to delete one or two of these.
Right now I'm using
`for(var i=0;i<itemArray.length;i++){`
To loop through it all, but it then does this EVERY onGUI call... making it extremely slow. Is there a way to place the elements once and when a change is made in another function only update this single element?
This is the script I'm using inside OnGUI():
for(var i=0;i<AgendaArray.length;i++){
var taskBegin = AgendaArray*[1];*
_var taskEnd = AgendaArray*[2];*_
<em>_var taskName = AgendaArray*[0];*_</em>
<em><em>_var taskStatus = AgendaArray*[5];*_</em></em>
<em><em>_*var thisStyle : GUIStyle;*_</em></em>
<em><em><em>_if(timer >= taskBegin && timer <= taskEnd && taskStatus != 2){AgendaArray*[5] = 1;}*_</em></em></em>
<em><em><em><em>_else if(timer>taskEnd && taskStatus != 2){AgendaArray*[5] = 3;}*_</em></em></em></em>
<em><em><em><em>_*if(taskStatus == 1){thisStyle = activeStyle;}*_</em></em></em></em>
<em><em><em><em>_*else if(taskStatus == 2){thisStyle = passedStyle;}*_</em></em></em></em>
<em><em><em><em>_*else if(taskStatus == 3){thisStyle = failedStyle;}*_</em></em></em></em>
<em><em><em><em>_*else{thisStyle = inactiveStyle;}*_</em></em></em></em>
<em><em><em><em><em>_var taskPosition = Screen.width*(taskBegin-beginOfTheDay)/lengthOfDay;_</em></em></em></em></em>
<em><em><em><em><em>_var taskWidth = Screen.width*((taskEnd-taskBegin)/lengthOfDay);_</em></em></em></em></em>
<em><em><em><em>_*GUI.Box(Rect(taskPosition,Screen.height-35,taskWidth,30),taskName,thisStyle);*_</em></em></em></em>
<em><em><em><em>_*}*_</em></em></em></em>
<em><em><em><em>_*```*_</em></em></em></em>