Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Getting Asset Preview Image from external directory

Discussion in 'UGUI & TextMesh Pro' started by bluenotebook4, Apr 18, 2021.

  1. bluenotebook4


    Feb 12, 2020
    Good day, I've been trying to wrap my head around a rather simple problem, though cant quite find a working solution to it.

    I want to load asset preview images of a 3D models from external directory, for example folder on a local computer, without loading the asset themselves (not sure if that's even possible), display their preview images on a grid layout(this part isnt the problem), and then be able to load said 3D models on demand at a later moment.

    The idea is that I could have a directory(possibly with multiple subdirectories within it), with 3D models outside of the project, whether its filesystem on server, or for starters - just a folder on computer, pull preview images of said models to the scene, display them on buttons(with image components), and then when individual buttons(with preview image of XYZ) model is pressed, I could retrieve(load) the model itself, avoiding the need to load entire directory of models at once. As far as I understand, AssetPreview class is a solution for such problem to work only in editor, where as I am looking for a solution to a built project.

    Another thought I had, though didn't quite look into it too much, is to have a way of saving Assetbundles of 3d models and their preview images within Unity Editor, save them in external directory, and then pull the assetbundle, but load only the preview image(?) at the beginning, and load 3d model (if needed) later.

    Any headers or help would be greatly appreciated.
    CTN-Originals likes this.
  2. CTN-Originals


    May 30, 2020
    Hello bluenotebook4.

    I might be able to help you with the 3d modal image preview generation but i don't know how to get files from a local path on the computer.

    I'm currently also making a 3D game where i have a lot of items and gameobject, the user can place these object down like any free build game, so i also needed to come up with something to preview those placeable objects.

    The way i do this is i set up some kind of GameObject Display that includes these Objects
    1. Camera
    2. Light
    3. ObjectParent
    --- 3.1. The Gameobject you want to get a preview from

    After that i create a Render Texture and i drag that on the the cameras "Target Texture"

    Now that that has been set up i can create a raw image on a ui and drag that Render Texture into the Texture of that Raw Image.



    I hope I understood this part of your question :D
  3. giantkilleroverunity3d


    Feb 28, 2014
    Loading and saving to a file system has been blocked in the past to keep the runtime environment secure.
    I always have ideas pertaining to this but get stopped.
    I can use sql for data storage though.