UI recipes
What this page is for
Section titled “What this page is for”Each recipe is a small screen that you build with the Inspector and no code. The steps come from the UI guide of the package. Every field, list and token a recipe uses was checked to exist in the code.
None of them was built in Unity for this page, so a step may need a small adjustment in your scene. The ready-made UI uses the same components in the same way for the character window, the HUD, the schemes list, the running schemes, the toasts and the clan court, so it is the best place to look when a recipe does not behave. See The ready-made UI.
Components and their options are on UI components. Tokens are on What you can write on a label.
1. My character panel
Section titled “1. My character panel”Goal: name, portrait, age, clan, role, traits, what the character thinks of me.
- Make a panel with a Subject Source, From = My player.
- Add an Image with a Bound Image, Kind = Portrait.
- Add TMP labels, each with a Bound Text (Text):
{this.FullName},{this.Age},{this.Clan.Name},{this.Title},{this.Traits},{this.OpinionOfMe}. - The last one means something on a character who is not you. To hide it on your own panel, add a Bound State with Check = Is My Player, Invert on, and put that label in Show When True.
- For traits as rows, add a Bound List, List = Traits, with a row template that holds a Bound Text
{this.Name}.
Result: the panel redraws when the name, age, clan or role changes, and when the player switches character.
2. A HUD line with my gold
Section titled “2. A HUD line with my gold”A TMP label with a Bound Text, {player.Gold} gold. No Subject Source is needed.
Result: the line follows your character’s Gold value. It assumes your game has a character value called Gold. The ready-made HUD has one such line, with the caption “Gold”, as a sample.
3. Date and speed buttons
Section titled “3. Date and speed buttons”- A label with a Bound Text
{world.Date}. - Buttons with a Command Button: Toggle Pause, Faster, Slower, and one with Set Speed and Speed = Fastest.
- Add a Tooltip Trigger to each. Show Reason is on by default.
Result: the date moves with the calendar. A button that cannot act, such as Faster at the fastest speed, is grey and says why.
4. The schemes I can start against a character
Section titled “4. The schemes I can start against a character”- A Subject Window, Shows = Actor, on an empty host object, with a child panel as its Panel.
- In the panel, a Bound List, List = Schemes To Start.
- A row template with a Subject Source (A row of a list) on its root, Bound Texts
{this.Name},{this.Reasons}and{this.SuccessChance}%, and a button with a Command Button, Command = Start Scheme. - In the row, a Bound State, Check = Can Start, with the Reasons label in Show When False.
- To reach the window, give a character button a Command Button with Command = Open (recipe 7).
Result: opening a character lists the schemes the player can start against them, why a scheme cannot start, its odds, and a Start button that is grey when it cannot. Start asks through the routed request. On a client the host decides. The ready-made window also sets Ask First on its Start button.
5. My running schemes and their objectives
Section titled “5. My running schemes and their objectives”- A Bound List, List = Running Schemes. With no source above it, it lists the player’s own.
- Row template: a Subject Source (A row of a list), a Bound Text
{this.Name}: {this.Objective}, and one with{this.Target.FullName}. - For a paused scheme, a Bound State with Check = Is Paused that shows a “paused” object.
- For the helpers, a second Bound List inside the row, List = Accomplices, whose rows show
{this.FullName}. A Bound State on it with Check = Is Not Empty can show a “Helped by” caption.
Result: a row per scheme, and the objective follows.
6. Toasts for world events
Section titled “6. Toasts for world events”- A vertical group with a Bound List, List = Notices. Notice Kinds starts with the news. Set Notice About = My player, Notice Seconds = 6, Notice Max = 5, Newest First on.
- Row template: a Subject Source (A row of a list) and a Bound Text
{this.Text}. - For a sound, add a Notice Receiver with a reaction: Kinds = Died, About = My player, On Notice = play a sound.
Result: a toast stack. A notice stays six seconds, or until five newer ones push it out. For a soft look set Row Fade In = 0.25 and Row Fade Out = 0.5 on the list. About = The subject above makes the feed of one character, clan or scheme. The ready-made toasts use Notice About = Anyone.
7. A list of my children, each opens its character
Section titled “7. A list of my children, each opens its character”A panel with a Subject Source (My player). Below it a Bound List, List = Relatives, Groups = Child. The row template has a Subject Source (A row of a list), a Bound Text {this.FullName} and a Command Button, Command = Open.
Result: a row per child. A click opens the child through a Subject Window (recipe 9, step 1).
8. A clan screen with its court
Section titled “8. A clan screen with its court”- A Subject Window, Shows = Clan, with a panel. In it: Bound Texts
{this.Name}and{this.MemberCount}, and a Bound Image, Kind = Icon (the banner). - A Bound List, List = Court, Also Vacant on. Row template with a Subject Source (A row of a list): Bound Texts
{this.Role.Name}and{this.Holder.FullName}(When Empty = “Vacant”), and a Bound State with Check = Is Vacant that can grey it. - To open the clan from a character panel, add a button with its own Subject Source (Related, Relation = Clan) and a Command Button, Command = Open.
- To show every holder of a seat as a card, put a second Bound List inside the row, List = Seat Holders, with a row template that has a Subject Source (A row of a list) and a Bound Text
{this.FullName}.
Result: one row per court role, with a card for each holder.
9. Click a name in any text and open my character screen
Section titled “9. Click a name in any text and open my character screen”- A Subject Window, Shows = Actor, whose panel is your character panel from recipe 1. Set the panel’s Subject Source to What a window opened, or remove it and the window adds one. A panel source set to anything else shows a yellow box in the Inspector.
- On each TMP label that prints names, add a Link Handler (Intrigues > UI > Link Handler) and switch Links on in its Bound Text.
Result: a click on a name asks the door to open that character and your window answers. Links needs the Link Handler on the same label.
10. A long list with pages
Section titled “10. A long list with pages”- A Bound List, List = All Actors, Page Size = 20, with a row template (Subject Source: A row of a list, Bound Text
{this.FullName}). - Two buttons with a Command Button, Command = Next Page and Previous Page, List = that list.
- A label with a Bound Text, Part = Count, List = that list.
Result: 20 rows at a time. A page button is grey on the first or last page.
11. A settings screen opened by a key
Section titled “11. A settings screen opened by a key”Goal: a page that the player opens with a key or a button and closes with the same key.
- Draw the page, a panel kept switched off, with Command Buttons: Change Language with a Language Code (
en, and one for another language of your story), and Set Speed with Speed = Normal. - On an object that stays on, such as the canvas, add a Subject Window. Set Screen =
settings, Panel = your panel, Toggle on. The panel needs no Subject Source. Its labels may read{player}and{world}. - On an object that stays on, add Intrigue Keys: Key = F10, Action = Open Screen, Screen =
settings. With Toggle on, a second press closes the page. - For a button instead of a key: a Command Button, Command = Open Screen, Screen =
settings. Escape and Close Screens close the page like any window.
Result: F10 shows and hides the page. Where no enabled window has the name settings, the button greys itself out and, with a Tooltip Trigger, says “There is no screen of that name.” The ready-made running-schemes window works the same way, with Screen = schemes and the key J.
More in the guide
Section titled “More in the guide”The guide has five more recipes. They use the same components and are not written out here.
| Recipe | What it builds |
|---|---|
| 12 | Pixel-perfect UI for pixel art and bitmap fonts, with Pixel Canvas Scale and the Check UI Pixel Grid tool. |
| 13 | A flag tray from a Bound List with List = Flags. The ready-made UI builds one. |
| 14 | An interaction menu with scheme categories, “N more…”, a “takes time” tag, a chance badge and accomplices. |
| 15 | The mind of a character or clan: memories, ties, ambitions and why they think so. |
| 16 | A save and load window from a Bound List with List = Save Slots. |
Mistakes and messages
Section titled “Mistakes and messages”- A row with no text. The row template’s Subject Source must have From = A row of a list.
- A list that shows nothing for a character. Lists about a character with no subject above are about your player. Put a Subject Source above the list.
- A button that stays grey. Read its tooltip when it has a Tooltip Trigger: the reason is a plain sentence.
- Windows that never open. A Subject Window must sit on an object that stays on, not on its own panel.
How it connects
Section titled “How it connects”- UI components describes the components used here.
- What you can write on a label lists the tokens.
- IntrigueUI from code does the same work from a script.
- Input, multiplayer and limits says what is not tested on a multiplayer client.