Setup

v1.0

Don't forget to check out the Demo Scene, which has a working system ready to check out.

1. Create Layers

Each portrait must have its own layer. I suggest naming them "Portrait0", "Portrait1", "Portrait2" and so on.

Create new Layers for each of your portraits. Open the Layers drop down and click the "Edit Layers" option at the bottom of the list to create new layers.

If you plan on using the Portraits Realtime Color system, which is optional, you need to also create a layer for that. Call it "ColorSampler".

2. Bring in Portrait Avatars

The Portraits/Prefabs folder has a Portrait Avatars Parent object, which includes PortraitAvatars component on it.

Bring this into your scene as a child of player object. Portrait Avatars instantiated during the game will be children of this object.

Populate the Player Avatar Prefab

In the Required section of the PortraitAvatars component, you'll need to provide your Potrait Avatar prefab. This is avatar object which will be spawned into the scene. Check the demo scene to view the "Portrait Avatar - Demo" object. This object should contain a Portrait component.

The "Portrait Avatar" object in the Prefabs folder can be duplicated and used as a starting point for your own portraits. Try getting the system working with a duplicated version of this before making a customized Avatar.

Set the Available Layers

In the Available Layers drop down, select only the layers you created previously. These are the layers which will be assigned to each portrait. Note that your game can only have as many portraits as there are available layers.

Set your Avatar Local Spawn Position

The Portrait Avatar Prefab you select will be instantiated at this position, local to the Portrait Avatars Parent object. If you are not using scene lighting to influence your 3D avatars, or if you aren't using 3D avatars, you may opt to choose a location that is very far away from the scene.

You can optionallly set the Background Color and other values in the PortraitsAvatar component.

3. Bring in the Portraits UI

Bring the Portraits UI object, located in the Prefabs folder, into your scene as a child of your Canvas.

This is where your UI portraits will appear. The object is preset with UI components, though you may need to customize it to fit your project.

With Portraits UI selected in your Hierarchy, you'll see the PortraitsPanel component in the Inspector.

Populate the UI Portrait prefab with the prefab you will be using. By default, the UI Portrait prefab is selected. For now, you may wish to ensure everything instantiates properly before creating your own custom UI Portrait object.

4. Test it!

Bring hte "Demo Buttons" prefab into your scene as a child of the Canvas. These are the buttons used in the Demo Scene, and they will allow you to test the set up, and confirm everything is working correctly.

Press play, and click the "Load Portrait" button in the top left. Your portrait should load!

Once that is working, you can create your own Portrait Avatar and UI Portrait, customized to fit your game, with your art work, and your unique logic.

pageCreate a Portrait AvatarpageCreate a UI Portrait

Last updated