void OnGUI(CADisplayLink sender){
//in case OnGui start before set scene
if(_runningScene!=null){
_runningScene.visitOnGUI();
}else{
// CCDebug.Log("cocos2d:CCDirector:OnGUI: runningScene is null :{0}", this.GetHashCode());
}
if (_displayStats) {
int w = Screen.width, h = Screen.height;
GUIStyle style = new GUIStyle();
style.alignment = TextAnchor.LowerLeft;
style.fontSize = h * 4 / 100;
style.normal.textColor = Color.white;
int rH = h / 100;
Rect rect = new Rect(0, h - rH * 8, w, rH * 8);
string text = string.Format("{0}\n{1:0.000}\n{2:0.0}", _ccNumberOfDrawsToShow, 1/_frameRate, _frameRate);
GUI.Label(rect, text, style);
}
if (_displayError && _lastError!=null) {
int w = Screen.width, h = Screen.height;
GUIStyle style = new GUIStyle();
style.alignment = TextAnchor.UpperLeft;
style.fontSize = Mathf.RoundToInt(h * 1.8f/ 100);
style.normal.textColor = Color.white;
Rect rect = new Rect(0, 0, w, h);
string text = string.Format("{0}", _lastError);
DrawQuad(new Rect(0, 0, w, h/2), new Color32(0, 0, 0, 128) );
GUI.Label(rect, text, style);
}
}
void DrawQuad(Rect position, Color color) {