void Update() { if (playerController == null && cave2manager.GetPlayerController(0) != null) { playerController = cave2manager.GetPlayerController(0).GetComponent <OmicronPlayerController>(); } if ((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) && Input.GetKeyDown(KeyCode.F11)) { showGUI = !showGUI; } bool isMaster = CAVE2Manager.IsMaster(); if (showFPS && ((showOnlyOnMaster && isMaster) || !showOnlyOnMaster)) { timeleft -= Time.deltaTime; accum += Time.timeScale / Time.deltaTime; ++frames; // Interval ended - update GUI text and start new interval if (timeleft <= 0.0) { // display two fractional digits (f2 format) float fps = accum / frames; string format = System.String.Format("{0:F2} FPS", fps); if (GetComponent <GUIText>()) { GetComponent <GUIText>().text = format; if (fps < 30) { GetComponent <GUIText>().material.color = Color.yellow; } else if (fps < 10) { GetComponent <GUIText>().material.color = Color.red; } else { GetComponent <GUIText>().material.color = Color.green; } } if (GetComponent <TextMesh>()) { GetComponent <TextMesh>().text = format; if (fps < 30) { GetComponent <TextMesh>().color = Color.yellow; } else if (fps < 10) { GetComponent <TextMesh>().color = Color.red; } else { GetComponent <TextMesh>().color = Color.green; } } // DebugConsole.Log(format,level); timeleft = FPS_updateInterval; accum = 0.0F; frames = 0; } } else { if (GetComponent <GUIText>()) { GetComponent <GUIText>().text = ""; } if (GetComponent <TextMesh>()) { GetComponent <TextMesh>().text = ""; } } }