/PreviewField

Unity package to allow prefab field with a Preview mode.

Primary LanguageC#MIT LicenseMIT

Preview Field

alt Preview Field splash When selecting a prefab, get a complete list of available prefabs with an interactive preview. Perfect for anyone looking for a more artist-friendly workflow.

Preview Field is a Unity3D editor extension, to allow for Prefab previews when selecting prefabs, models etc. When creating a public object (Prefab) field in a MonoBehaviour or ScriptableObject, by adding the [PreviewField] attribute (available in the CollisionBear.PreviewObjectPicker namespace) the property will look slightly different. To the far right is a new Prefab picker button, opening the preview object selector.

Getting started

First you need to get your hands on a copy of the editor. We support a few options.

Unity Package

The editor extension can be added Unity's package manager from 'Add package from git URL'

Manual download

It can be downloaded from the following sources.

Example

Decorate a public property with the attribute.

using 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 using CollisionBear.PreviewObjectPicker;

public class TestClass: ScriptableObject {
	[PreviewField]
	public Collider ColliderPrefab;
}

or a custom MonoBehaviour

using using CollisionBear.PreviewObjectPicker;

public class TestComponent : MonoBehaviour { }

public class TestClass: ScriptableObject {
	[PreviewField]
	public TestComponent TestComponentPrefab;
}

License

This project is released as Open Source under a MIT license.