Skip to content

Tutorial 10: Your own character panel

A panel on your canvas, drawn by you, that shows the player’s character and lets the player start a scheme.

  • A name and an age, kept current.
  • A list of the character’s children, one row each.
  • A list of the schemes the player can start, each with a button.

The panel uses four components and no script. You need a scene that runs Intrigues, with a player character, and a canvas with an EventSystem. The ideas behind it are on UI components and What you can write on a label.

  1. Make a Canvas with a Panel, with the normal Unity tools.
  2. On the panel choose Add Component > Intrigues > UI > Subject Source.
  3. Leave From on My player.

The Subject Source says who this part of the screen is about. Everything on the panel or below it is about that character, and when the player switches to another character, the panel follows without any work from you.

  1. Make a TextMeshPro label under the panel. The label must be a TMP_Text.
  2. On it choose Add Component > Intrigues > UI > Bound Text.
  3. Set Mode to Text. In Text, write {this.FullName}, {this.Age}.

A token is a word in curly braces. {this} is the subject of the Subject Source above. The button {this…} under the field lists the members that exist and warns about one that does not.

Press Play. The label shows the player’s name and age. When the character gets older, the label changes by itself. The Inspector shows Now shows with what the label has now.

  1. Under the panel make an empty object, and add Bound List to it. Add a Unity layout group to it if you want the rows stacked.
  2. Set List to Relatives and Groups to Child.
  3. Make a child of that object with a label, and switch the child off. This is the row template. Put a Subject Source on its root and set From to A row of a list. Add a Bound Text with {this.FullName}.
  4. Drag the template into Row Template on the list.

The list makes one copy of the row for each child. Rows stay while they stand for the same character. A row whose template has no Subject Source with A row of a list shows no text, so check that first.

To make a row open the child, add a Command Button with Command set to Open on a Unity button inside the row. That needs a window to show the child. See recipe 7 on UI recipes.

Step 4. A list of schemes and a button that starts one

Section titled “Step 4. A list of schemes and a button that starts one”
  1. Add a second Bound List under the panel. Set List to Schemes To Start. Leave Offer Rules at its default.
  2. Make a row template, switched off, as before: a Subject Source with From set to A row of a list on its root.
  3. In the row, add a Bound Text with {this.Name} and a second with {this.Reasons}.
  4. Add a Unity Button to the row. On it choose Add Component > Intrigues > UI > Command Button and set Command to Start Scheme.
  5. Drag the row into Row Template. If you want a question first, write it in Ask First, for example Start {this.Name}?. Yes Text and No Text are the two answers; they start as Yes and No. Leave Ask First empty to start at once.
  6. Set Empty Object to a label that says there is nothing to start.

Start Scheme acts on a row of Schemes To Start. The button is grey while the scheme cannot start. With Show Reason on and a Tooltip Trigger on the button, the tooltip says why in a plain sentence.

With Offer Rules at its default, a list on the player’s own panel offers the schemes that have Target Not Required on. A scheme that needs a target is offered through a window about another character; that is recipe 4 on UI recipes. Whether a scheme is listed at all also depends on its own Show in lists setting. A scheme that is already running is left out too, so its row goes away after you start it.

Press Play with a world that has a player character.

You should see If you do not
The name and the age in the first label. A label that shows its braces means a token names nothing. The {this…} button lists the real members.
One row for each child. An empty list means the character has no children, or the row template lacks its Subject Source.
A row for each scheme with Target Not Required that the player is not running yet. An empty list shows your Empty Object. Check the scheme’s Target Not Required and Show in lists settings.
A grey Start button with a reason, or a live one. Without a Tooltip Trigger there is no tooltip to show the reason.
After you press a live Start button, the scheme runs. In Tools > MrW > Intrigues > UI Setup, the Scene check tab names what the scene lacks, such as an EventSystem.

In Play mode the Bound List shows a line such as N rows of M, and the Command Button shows can run or refused with its reason.

  • A yellow box on a component. It names the set-up mistake. Bound Text needs a TextMeshPro label, and Command Button needs a Button on the same object.
  • Two components write one label. Give each label one Bound Text.