예제 #1
0
        public bool OnPreviewGUI(Rect region, GUIStyle background, Material material)
        {
            var newPreviewDir = Drag2D(previewDir, region);

            if (newPreviewDir != previewDir)
            {
                previewDir = newPreviewDir;
                PreviewTextureManager.Clear();
            }

            var texture = PreviewTextureManager.GetPreviewTexture(region, previewDir, material);

            if (!texture)
            {
                return(false);
            }
            GUI.DrawTexture(region, texture, ScaleMode.StretchToFill, false);
            return(true);
        }
예제 #2
0
        public static bool OnPreviewGUI(Rect region, GUIStyle background, Material material)
        {
            var newPreviewDir = Drag2D(previewDir, region);

            if (newPreviewDir != previewDir)
            {
                previewDir = newPreviewDir;
                PreviewTextureManager.Clear();
            }

            var texture = PreviewTextureManager.GetPreviewTexture(region, previewDir, material);

            if (!texture)
            {
                if (Event.current.type == EventType.Repaint)
                {
                    background.Draw(region, false, false, false, false);
                }
                return(false);
            }
            GUI.DrawTexture(region, texture, ScaleMode.StretchToFill, false);
            return(true);
        }