how does unity make previews?

you know how a preview of a prefab shows up in a browser or in the inspector, i’d like to know how they do that :slight_smile:

trying to avoid making a GUI icon for each and every object in my game, and thought if they can do the previews, I should be able to use that for my problem… if i knew how they did it that is…

example:

ah yes and i want it in game so not like the AssetPreview.GetAssetPreview();

well which i guess is how unity does it… bummer.

Oh well any way then doing something similar during run time?

You could do it with Render Texture but obviously you’ll need Pro to do that.

Unfortunately, AssetPreview.GetAssetPreview(); is probably what they’re using to make the previews, so you sort of already know the answer to your own question.

well yes actually i ment how do they do AssetPreview…
do i imagine a scene with a cam in somewhere behind the editor interface where every prefab poses in front of the cam to get their picture taken and then the return is that result??

Your idea of how that is done is pretty close, which is why you’d be able to do it with RenderTexture. Although, if you don’t have Unity Pro, I would just write a script for and do it that way.

You can do it without pro as well, but it will be slower without renderTexture.
Just position the camera close to the object, read the screen pixels and put them into a texture, than save it as png if needed.
Pretty easy to do with a script.

Edit: Also, do you really need it during runtime? One thing to consider is saving them as images with an editor script.

well i can automate the snapshot taking i won’t be needing it in runtime… unless if i want them as 3D turnables…