Preview Field
Select Prefabs with an interactive preview and get a complete list of Prefabs available to choose from. Perfect for anyone looking for a more artist-friendly workflow.
Preview Field is a Unity3D editor extension that allows for an improved Prefab selection process. When used, Unity's default prefab selection field is replaced with our new Preview field. It looks similar enough for anyone who has worked with Prefabs before to know how to use it. The main feature of this Editor Field is the Preview Selection button, located on the far right of the field. [insert image of preview field].
To enable Preview fields, when creating a public field in a GameObjectMonoBehaviour or GameObjectScriptableObject for either a GameObject or any types derived from Component add the [PreviewField] attribute (available in the CollisionBear.PreviewObjectPicker namespace) to the property. Unity's default editor field will now be replaced with the Preview Field.
Getting started
First, you need to get your hands on a copy of the editor. We support a few options.
Unity Asset store
This is the preferred way of getting the package. Browse to it using the link below and press Add to my Assets. This will take you to Unity's asset manager, where you can download and install it.
We will release all minor updates to the Asset store at regular intervals.
Preview Field in Unity Asset Store
Unity Package Manager
The editor extension can be added to Unity's package manager from 'Add package from git URL'
Github.com is where we store the package's source code. You will always be able to find the latest versions here first.
https://github.com/collisionbear/previewfield.git
Manual download
It can be downloaded from the following sources.
You need to put the PreviewField content inside your Unity project's Asset folder.
Usages
Preview field is an explicit editor field attribute and will only affect the fields you use it on. Using this editor is non-destructive. You can add or remove it from fields, or remove the entire plugin altogether without affecting the data in your project.
Unity's standard UI for prefab selection
Prefab selection with [PreviewField] enabled
Preview field uses Reflection to determine what type the fields are, and in turn, what Prefabs should be made visible.
Example
Decorate a public property with the attribute.using CollisionBear.PreviewObjectPicker; class TestClass: ScriptableObject { [PreviewField] public GameObject SomeTestPrefab; }
or
public class TestClass: ScriptableObject { [CollisionBear.PreviewObjectPicker.PreviewField] public GameObject SomeTestPrefab; }
This also works for any Component based scripts.
using CollisionBear.PreviewObjectPicker; public class TestClass: ScriptableObject { [PreviewField] public Collider ColliderPrefab; }
or a custom MonoBehaviour
using CollisionBear.PreviewObjectPicker; public class TestComponent : MonoBehaviour { } public class TestClass: ScriptableObject { [PreviewField] public TestComponent TestComponentPrefab; }
License
This project is released as Open Source under an [MIT license](https://opensource.org/licenses/MIT).