void OnGUI() { string msg = "Press [Space] to cycle timescale (Current value: " + Time.timeScale.ToString("0.0") + ")"; if (m_lastProjectile) { msg += "\nTargetSpeedAtTimeOfCalculation: " + m_targetSpeedAtTimeOfCalculation.ToString(); msg += "\nProjectileSpeedAtTimeOfCalculation: " + m_projectileSpeedAtTimeOfCalculation.ToString(); msg += "\nLastPredictionFoundValidSolution: " + m_lastPredictionFoundValidSolution.ToString(); } else { msg += "\nAccumulatedTime: " + m_accumulatedTime.ToString(); } GUI.color = Color.black; GUI.Label(s_infoRectShadow, msg); GUI.color = Color.white; GUI.Label(s_infoRect, msg); Camera mainCam = Camera.main; msg = "bulletStartPos"; DebuggingUtils.DrawTextInWorld(mainCam, bulletStartPos, msg, Color.red); if (m_lastProjectile) { msg = "lastProjectile"; msg += "\nProjectileRigidBodySpeed: " + m_lastProjectile.velocity.magnitude.ToString(); msg += "\nProjectileMeasuredSpeed: " + m_measuredProjectileSpeed.ToString(); DebuggingUtils.DrawTextInWorld(mainCam, m_lastProjectile.transform.position, msg, Color.red); } }
private static void CollectExceptionInfo(Exception exception, List <StackInfoTuple> globalFrames, StringBuilder excMsg) { if (excMsg.Length > 0) { excMsg.Append(" ---> "); } excMsg.Append(exception.GetType().FullName); excMsg.Append(": "); excMsg.Append(exception.Message); var innerExc = exception.InnerException; if (innerExc != null) { CollectExceptionInfo(innerExc, globalFrames, excMsg); globalFrames.Add(new("", "--- End of inner exception stack trace ---", 0)); } var stackTrace = new StackTrace(exception, fNeedFileInfo: true); foreach (StackFrame frame in stackTrace.GetFrames()) { DebuggingUtils.GetStackFrameMethodDecl(frame, out string methodDecl); globalFrames.Add(new(frame.GetFileName(), methodDecl, frame.GetFileLineNumber())); } }
/// <summary> /// A method change degree metric button. </summary> /// <param name="isDegree"> A flag value indicates which metric is used (Degree, Radian) </param> private void SetDegreeButton(bool isDegree) { Operators.IsDegreeMetricUsed = isDegree; if (isDegree) { DegreeMetricImageFileName = radianImageFileName; } else { DegreeMetricImageFileName = degreeImageFileName; } OnPropertyChanged("DegreeMetricImageFileName"); DebuggingUtils.Dbg("degree metric " + (Operators.IsDegreeMetricUsed ? "Degree" : "Radian")); }
////////////////////////////////////////////////////////////////////////////// void OnGUI() { Camera mainCam = Camera.main; string msg = "targetPos"; msg += "\nTargetRigidBodySpeed: " + GetComponent <Rigidbody>().velocity.magnitude.ToString(); msg += "\nTargetMeasuredSpeed: " + m_measuredSpeed.ToString(); msg += "\nLastHitRigidBody: "; if (m_nameOfLastHitRigidBody.Length > 0) { msg += m_nameOfLastHitRigidBody; } else { msg += "None"; } DebuggingUtils.DrawTextInWorld(mainCam, transform.position, msg, Color.blue); }