private void OnGuiHandler()
        {
#if CINEMACHINE_UNITY_IMGUI
            if (!m_ShowDebugText)
            {
                CinemachineDebug.ReleaseScreenPos(this);
            }
            else
            {
                // Show the active camera and blend
                var   sb    = CinemachineDebug.SBFromPool();
                Color color = GUI.color;
                sb.Length = 0;
                sb.Append("CM ");
                sb.Append(gameObject.name);
                sb.Append(": ");
                if (SoloCamera != null)
                {
                    sb.Append("SOLO ");
                    GUI.color = GetSoloGUIColor();
                }

                if (IsBlending)
                {
                    sb.Append(ActiveBlend.Description);
                }
                else
                {
                    ICinemachineCamera vcam = ActiveVirtualCamera;
                    if (vcam == null)
                    {
                        sb.Append("(none)");
                    }
                    else
                    {
                        sb.Append("[");
                        sb.Append(vcam.Name);
                        sb.Append("]");
                    }
                }
                string text = sb.ToString();
                Rect   r    = CinemachineDebug.GetScreenPos(this, text, GUI.skin.box);
                GUI.Label(r, text, GUI.skin.box);
                GUI.color = color;
                CinemachineDebug.ReturnToPool(sb);
            }
#endif
        }
Example #2
0
 ///  Will only be called if Unity Editor - never in build
 private void OnGuiHandler()
 {
     if (!m_ShowDebugText)
     {
         CinemachineDebug.ReleaseScreenPos(this);
     }
     else
     {
         var sb = CinemachineDebug.SBFromPool();
         sb.Append(Name); sb.Append(": "); sb.Append(Description);
         string text = sb.ToString();
         Rect   r    = CinemachineDebug.GetScreenPos(this, text, GUI.skin.box);
         GUI.Label(r, text, GUI.skin.box);
         CinemachineDebug.ReturnToPool(sb);
     }
 }