The prefab view feature allows you to use actual prefabs as portraits.
You want to show the prefab of an item or equipment in a menu screen? Or show a close up of a combatant’s face in a dialogue? Prefab view portraits allow you to do just that! For prefab view, all you need is a camera prefab and a render texture.
Prefab view portraits are availbale for everything with portraits and prefabs, e.g. combatants, items, weapons and armors.
Prefab View Settings
The general settings for prefab view are defined in Menus > Menu Settings in the Prefab View Settings.
The camera settings define the camera prefab and render texture that will be used.
The camera prefab requires a prefab with a Camera component attached. Make sure the camera can render the View Layer for displaying the prefabs (defined in the Prefab Settings). The camera will be spawned with a defined offset to the displayed prefab of the portrait and uses the render texture as output for the camera.
The portrait will use the render texture in the UI to display what the camera sees. The camera settings can optionally be overridden by each portrait individually.
The prefab settings handle how multiple prefabs from portraits will be spawned to prevent them from overlapping or their cameras showing another portrait’s prefab.
The Spawn Position defines where the prefabs will be spawned in world space – the default setting spawns them far off the regular space you’d use in your scene. The Spawn Offset handles the offset between each spawned prefab, i.e. this setting is used to prevent prefabs from overlapping. Increase the spawn offset in case your prefabs are overlapping or the camera shows multiple prefabs.
The View Layer defines on which layer the prefabs are spawned on. Make sure the camera prefab can render this layer, and your actual scene’s camera can’t – otherwise the scene camera might show the spawned portrait prefabs somewhere in the background.
You can also disable colliders and set rigidbodies to be kinematic on the spawned portrait prefabs to prevent issues with physics.
Additional to the portrait prefab, you can spawn a background prefab with a defined offset to the portrait prefab. This can be used to e.g. display a prefab with a wall or landscape as background. The background prefab will also be placed on the View Layer defined in the prefab settings.
The background settings can optionally be overridden by each portrait individually.
Prefab View Portraits
The prefab view is used by portraits to render the prefab of whatever the portrait is displayed for (e.g. a combatant). Instead of a defined image, the portrait shows a spawned prefab as the portrait.
Prefab view portraits are available for everything that supports portraits and has a prefab. There are some special cases, e.g. equipment will prioritize viewer prefabs over the item prefab, or combatants will show the prefab according to the conditional prefabs (i.e. use the currently valid prefab). Additionally, portraits can define a prefab that will be used instead of using the actual prefab of the displayed data.
The portrait can target a child object of the spawned prefab to allow different shots, e.g. a close up of a combatants face instead of the whole combatant. Portraits can optionally override the default camera and background settings defined in the prefab view settings.
Own Prefab View Layer
To prevent the scene camera and prefab view cameras showing things they shouldn’t, it’s best to set up a layer only designated for the prefab view.
Remove that layer from all your scene cameras and have the prefab view cameras only render that layer.
Transparent Camera Background
You can set up your Camera on the camera prefab to render everything with a transparent background, i.e. only showing the prefabs.
Set the camera’s Clear Flag setting to Solid Color and set the Background color to use a color with an alpha value of 0 (A=0).