UnityEditor.Editor.RenderStaticPreview C# (CSharp) Method

RenderStaticPreview() public method

Override this method if you want to render a static preview that shows.

public RenderStaticPreview ( string assetPath, Object subAssets, int width, int height ) : Texture2D
assetPath string
subAssets Object
width int
height int
return UnityEngine.Texture2D
        public virtual Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height)
        {
            return null;
        }

Usage Example

        public static Texture2D CreatePreviewForAsset(UnityEngine.Object obj, UnityEngine.Object[] subAssets, string assetPath)
        {
            if (obj == null)
            {
                return(null);
            }
            System.Type type = CustomEditorAttributes.FindCustomEditorType(obj, false);
            if (type == null)
            {
                return(null);
            }
            MethodInfo method = type.GetMethod("RenderStaticPreview");

            if (method == null)
            {
                Debug.LogError("Fail to find RenderStaticPreview base method");
                return(null);
            }
            if (method.DeclaringType == typeof(Editor))
            {
                return(null);
            }
            Editor editor = Editor.CreateEditor(obj);

            if (editor == null)
            {
                return(null);
            }
            Texture2D textured = editor.RenderStaticPreview(assetPath, subAssets, 0x80, 0x80);

            UnityEngine.Object.DestroyImmediate(editor);
            return(textured);
        }
All Usage Examples Of UnityEditor.Editor::RenderStaticPreview