Textboxes
A short overview of how to use Text Boxes, like those used for shrine popups or NPC dialogue.
Last updated
A short overview of how to use Text Boxes, like those used for shrine popups or NPC dialogue.
Last updated
Enter the Gungeon uses a variety of different text boxes to represent character dialogue, or other general information that would otherwise be unavailable to the player. This short guide aims to explain how to make and use text boxes.
Text boxes are handled by the TextBoxManager class, which contains a variety of methods to display text ingame. The main one for dialogue is ShowTextBox. Below is an example of using the TextBoxManager.ShowTextBox method, with a table explaining what each variable does.
A fuller explanation of variables used in the above example.
worldPosition
Vector3
N/A
The position of the text box in the game world.
parent
Transform
N/A
The object that the text box is originating from. If this object moves, the text box will move too. Additionally, the parent is used by the TextBoxManager to organise boxes. If a new text box is created on the same parent as an existing text box, the existing text box will be closed.
duration
float
N/A
How long the text box will remain on screen before automatically closing. Measured in seconds. If the value is set to -1f, the text box will last forever until manually closed by more code.
text
string
N/A
The text that appears in the box.
audioTag
string
""
Determines what 'voice' the text box speaks in. Different NPCs use different voice sound effects. See the Audio Tags section for a full list of voices.
instant
bool
true
If set to true, all the text in the box will appear instantly. If set to false, the text in the box will appear in the form of a quick scroll.
slideOrientation
TextBoxManager.BoxSlideOrientation
NO_ADJUSTMENT
Controls how the textbox appears. Text boxes, by default, will appear relative to the origin point in a way that is most optimal for screen space. IE; if there is more camera space to the right of the origin point, the text box will be predominantly to the right. If set to FORCE_RIGHT, the text box will always appear to the right of the origin regardless of available screen space. FORCE_LEFT has the same effect on the left. side.
showContinueText
bool
false
If set to true, three dots will appear in the lower right region of the text box. Has no function, but is used in the vanilla game to indicate that the player must press a key to progress the current conversation.
useAlienLanguage
bool
false
If set to true, the text in the box will appear in Professor Gooptons alien language font.
In addition to the ShowTextBox method, there are other methods which produce similar boxes but with different visual appearances. These methods all take very similar arguments to ShowTextBox, although ShowInfoBox and ShowThoughtBubble do not use character voices, do not take slide adjustments, and cannot be written in Goopton's Alien Language.
ShowTextBox
TextBoxManager.ShowTextBox(user.sprite.WorldCenter + new Vector2(0f, 1f), user.transform, -1f, "Lorem ipsum dolor sit amet", audioString, instant: false);
ShowInfoBox
TextBoxManager.ShowInfoBox(user.sprite.WorldCenter + new Vector2(0f, 1f), user.transform, -1f, "Lorem ipsum dolor sit amet", instant: false);
ShowThoughtBubble
TextBoxManager.ShowThoughtBubble(user.sprite.WorldCenter + new Vector2(0f, 1f), user.transform, -1f, "Lorem ipsum dolor sit amet", instant: false);
Panels are a different type of text display also handled by the TextBoxManager class. Panels are typically used when interacting with inanimate objects that display a significant amount of text such as shrines, notes, and signs.
Each different type of panel takes the exact same arguments and works in the exact same way, save for their visual appearance. These arguments are the same as some of the arguments used to display regular textboxes.
A table of the different types of panel and an example of how to use them. (Note that usually when spawning a panel, you'd make it's source position and parent relative to the object that the text is supposedly written on, such as a shrine, rather than the player.)
ShowLetterBox
TextBoxManager.ShowLetterBox(user.sprite.WorldCenter + new Vector2(0f, 1f), user.transform, -1f, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", instant: true);
ShowStoneTablet
TextBoxManager.ShowStoneTablet(user.sprite.WorldCenter + new Vector2(0f, 1f), user.transform, -1f, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", instant: true);
ShowWoodPanel
TextBoxManager.ShowWoodPanel(user.sprite.WorldCenter + new Vector2(0f, 1f), user.transform, -1f, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", instant: true);
ShowNote
TextBoxManager.ShowNote(user.sprite.WorldCenter + new Vector2(0f, 1f), user.transform, -1f, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", instant: true);
While panels can be set to scroll like character dialogue, they tend to look much better with instant set to true, as there is no character 'speaking' the text.
Audio Tags, as explained above, are string identifiers used to define what 'voice' a text box speaks in. The 'voice' in this case is the jumbled sound effects that play as the text is drawn on screen. Different voices might use different sounds, pitch, etc.
If no valid audio speech tag is set, the text box will appear in complete silence.
"male"
Lost Adventurer, Circle Knight, Square Knight
"female"
Sorceress, Patches, Mendy, Blacksmith
"shopkeep"
Bello, Trorc, Old Red, Henchman
"alien"
Professor Goopton
"fool"
Sell Creep, Ledge Goblin
"robot"
Drunkard, Muncher, Evil Muncher, Welcome Bot
"goofy"
Tonic
"jolly"
Frifle
"oldman"
Old Man, The Grey Mauser, Flynt, Save Button, Dr. Wolf
"gambler"
Winchester
"dice"
Daisuke
"bower"
Bowler
"gunslingking"
Gunsling King
"golem"
Ox
"truthknower"
Brother Albern, Manservantes, Tailor, The Robot (Unlock Scene)
"teen"
Cursula
"brat"
Cadence
"rat"
Resourceful Rat (NPC)
"ratboss"
Resourceful Rat (Boss Intro)
"witch1"
Hunchie
"witch2"
Squintie
"witch3"
Beakie
"tutorialknight"
Ser Manuel, Gunknights, The Bullet, Hegemony Soldiers, Dying Scientist
"owl"
Monster Manuel
"lady"
Synergrace
"bug"
Doug
"vampire"
Vampire
"manly"
The Marine, The Gunslinger, The Paradox, Black Stache
"frump"
Blockner
"coop"
The Cultist
"computer"
The Robot
"convict"
The Convict, The Hunter
"spacerogue"
The Pilot
"agunim"
Agunim
"mainframe"
EMP-R0R
None
N/A
Dragunfire Cultist, Cop, Gunther