Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Create custom Asset Preview and Project window entry

Discussion in 'Scripting' started by antoine-agthe, Apr 2, 2013.

  1. antoine-agthe

    antoine-agthe

    Joined:
    Nov 1, 2012
    Posts:
    15
    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
     
  2. antoine-agthe

    antoine-agthe

    Joined:
    Nov 1, 2012
    Posts:
    15
    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.
     
    Last edited: Apr 3, 2013
  3. startassets

    startassets

    Joined:
    Feb 13, 2017
    Posts:
    11
    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.