UnityEditor.PreviewRenderUtility.BeginStaticPreview C# (CSharp) Method

BeginStaticPreview() public method

public BeginStaticPreview ( Rect r ) : void
r UnityEngine.Rect
return void
        public void BeginStaticPreview(Rect r)
        {
            this.BeginStaticPreview(r, false);
        }

Same methods

PreviewRenderUtility::BeginStaticPreview ( Rect r, bool hdr ) : void

Usage Example

示例#1
0
        public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height)
        {
            AudioClip clip = target as AudioClip;

            AssetImporter importer      = AssetImporter.GetAtPath(assetPath);
            AudioImporter audioImporter = importer as AudioImporter;

            if (audioImporter == null || !ShaderUtil.hardwareSupportsRectRenderTexture)
            {
                return(null);
            }

            if (m_PreviewUtility == null)
            {
                m_PreviewUtility = new PreviewRenderUtility();
            }

            m_PreviewUtility.BeginStaticPreview(new Rect(0, 0, width, height));

            // We're drawing into an offscreen here which will have a resolution defined by EditorGUIUtility.pixelsPerPoint. This is different from the DoRenderPreview call below where we draw directly to the screen, so we need to take
            // the higher resolution into account when drawing into the offscreen, otherwise only the upper-left quarter of the preview texture will be drawn.
            DoRenderPreview(clip, audioImporter, new Rect(0.05f * width * EditorGUIUtility.pixelsPerPoint, 0.05f * width * EditorGUIUtility.pixelsPerPoint, 1.9f * width * EditorGUIUtility.pixelsPerPoint, 1.9f * height * EditorGUIUtility.pixelsPerPoint), 1.0f);

            return(m_PreviewUtility.EndStaticPreview());
        }
All Usage Examples Of UnityEditor.PreviewRenderUtility::BeginStaticPreview