This repository contains two custom Unity Editor tools to help you generate previews of your assets / game:
-
Camera Preview Generator
Generates a PNG image of a selected prefab or GameObject using a custom camera. It allows you to configure the camera’s field of view, distance, rotation, resolution, background color, and layer-based rendering options. -
Icon Preview Generator
Generates a PNG preview (icon) for a selected prefab or GameObject. You can choose to use the asset’s folder path for saving the icon automatically or manually specify a save path.
-
Customizable Camera Settings:
Adjust the field of view, distance (or auto-calculate it), and rotation of the camera to capture the perfect angle. -
Resolution Options:
Set a fixed resolution or use proportional dimensions for the output image. -
Background and Layer Control:
Define the background color and clear flags, and optionally render only specific layers. -
Easy Preview Generation:
Generate quick previews of assets directly from the Unity Editor.
- Place the
CameraPreviewGenerator.cs
file in your Unity project'sEditor
folder. - In Unity, go to Tools > PreviewTools > Generate Preview From Camera.
- In the window, select the object (prefab or GameObject) you wish to render.
- Configure the camera settings, resolution, background, and layer options as needed.
- Click Generate Image. The PNG will be saved at the specified output path.
- Place the
IconPreviewGenerator.cs
file in your Unity project'sEditor
folder. - In Unity, go to Tools > PreviewTools > Generate Preview From Icon.
- In the window, select the object (prefab) for which you want to generate an icon.
- Optionally, check Use Object's Path to automatically set the save path based on the asset location.
- Click Generate Preview to display the generated preview in the window.
- If you like the preview, click Save PNG to write the image to disk.
- Unity 5.6.7 or later.
- The scripts must be placed inside a folder named
Editor
in your project.Above, this code is already in the Editor folder, so you should unzip it, anywhere in the Assets folder, I advise you to create an Editor Tools folder and put all plugins or extensions there
This project is licensed under the MIT License. See the LICENSE file for details.