Create custom Asset Preview and Project window entry

Hi Guyz,

I develop a library that defines a new kind of asset.
I used ScriptableObject that made it simple, but now I wanna make things as clean as possible in creating a deep integration in Unity3D interface.

Two things are missing: a clean asset preview, and a useful entry in Project window.

I’ve seen AssetPreview.GetAssetPreview (), and EditorApplication.GetAssetPreview () that retrieves the preview of an asset, but I can’t find a way to make these previews from custom assets.

I wanna use a FBX-like behavior in Project window.
When I import a FBX file in my project, Unity3D can parse it, and display meshes, and animations, independently, in the Project window, by expanding the main asset. My custom asset could provide “subassets” like that, but I can’t find the way to do it.

Cheers

OK, found a way for “subassets”. AssetDatabase.AddObjectToAsset () was the key.
And Preview seems to be implemented in Custom Editor classes (just override OnPreviewGUI () )

But I still have a problem.
When I add some “subassets” to my main one, it becomes a subasset too, and the new “main” asset is just subasset container, without any property in the Inspector window.
It’s not that bad, but it’s not perfect.
Now I need to find a way to attach settings or custom editor to this main subasset container.

Hi, antoine-agthe, I’ve just finished my own preview asset, maybe it will be useful for you: https://forum.unity3d.com/threads/powerful-preview.460157/. It looks and behaves just like the native one.