Editor.RenderStaticPreview

Switch to Manual
public Texture2D RenderStaticPreview (string assetPath, Object[] subAssets, int width, int height);

Parameters

assetPathThe asset to operate on.
subAssetsAn array of all Assets at assetPath.
widthWidth of the created texture.
heightHeight of the created texture.

Returns

Texture2D Generated texture or null.

Description

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

When overridden RenderStaticPreview can be used to render a list of assets converted into a single texture. This function will need user supplied source code that can merge the assets together. The size of the create texture can be supplied by the provided width and height.
If null is returned the builtin icon for the class type is used.

// Render the provided asset texture into an Inspector thumbnail.
using UnityEngine;
using System.Collections;
using UnityEditor;

using System.IO;

public class Example : ScriptableObject { public Texture2D PreviewIcon; }

[CustomEditor(typeof(Example))] public class ExampleEditor : UnityEditor.Editor { public static void CreateAsset<Example>() where Example : ScriptableObject { Example asset = ScriptableObject.CreateInstance<Example>();

string path = AssetDatabase.GetAssetPath(Selection.activeObject);

if (path == "") { path = "Assets"; } else if (Path.GetExtension(path) != "") { path = path.Replace(