UnityEditor.WebCamTextureInspector.OnPreviewGUI C# (CSharp) Method

OnPreviewGUI() public method

public OnPreviewGUI ( Rect r, GUIStyle background ) : void
r UnityEngine.Rect
background UnityEngine.GUIStyle
return void
        public override void OnPreviewGUI(Rect r, GUIStyle background)
        {
            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(r, false, false, false, false);
            }
            WebCamTexture target = base.target as WebCamTexture;
            float num = Mathf.Min(Mathf.Min((float) (r.width / ((float) target.width)), (float) (r.height / ((float) target.height))), 1f);
            Rect viewRect = new Rect(r.x, r.y, target.width * num, target.height * num);
            PreviewGUI.BeginScrollView(r, this.m_Pos, viewRect, "PreHorizontalScrollbar", "PreHorizontalScrollbarThumb");
            GUI.DrawTexture(viewRect, target, ScaleMode.StretchToFill, false);
            this.m_Pos = PreviewGUI.EndScrollView();
            if (target.isPlaying)
            {
                GUIView.current.Repaint();
            }
            if (Application.isPlaying)
            {
                if (target.isPlaying)
                {
                    EditorGUI.DropShadowLabel(new Rect(r.x, r.y + 10f, r.width, 20f), "Can't pause preview when in play mode");
                }
                else
                {
                    EditorGUI.DropShadowLabel(new Rect(r.x, r.y + 10f, r.width, 20f), "Can't start preview when in play mode");
                }
            }
        }