Function OnGUI
-
How often/ when is it called
-
Do i need to use it when im making a window that has a scroll bar
-
when is the best time to use it
function OnGUI () {
var Temp = TurnManagerGO.GetComponent(TurnManager);
var ALH = new List.();
ALH = Temp.ActionList;
var ALHS : GameObject;
var ALHS2 : Stats;
var aTexture : GUITexture;
var Spacer : int;
var LCount : int;
LCount = ALH.Count;
Debug.Log(LCount);
// An absolute-positioned example: We make a scrollview that has a really large client
// rect and put it in a small rect on the screen.
scrollPosition = GUI.BeginScrollView (Rect (0,0,900,120), scrollPosition, Rect (0, 0, 820, 110));for(var i = 0; i < LCount; i++){ ALHS = ALH*;*
- Debug.Log(ALHS);*
- ALHS2 = ALHS.GetComponent(Stats);*
- aTexure = ALHS2.PlayerGUI;*
- Spacer = 5;*
_ //GUI.DrawTexture(Rect(((i * Spacer) + (i * 100)),10,100,100), aTexture, ScaleMode.ScaleToFit, true, 0);_
}
GUI.EndScrollView ();
}
is this a good use of OnGUI