The Question Mark's Two Other Identities: ?type Option Types and ?Name Optional Parameters
Lesson 13 introduced you to the postfix ? query operator — but the question mark moonlights in two more jobs in Verse: standing before a type it means "might be empty", and standing before a parameter it means "okay to leave out". This page lines up all three faces of the question mark side by side, so the next time you meet one you'll never get lost.
1. Live from the Forums: What on Earth Is ?creative_prop
There's a textbook question on the Epic developer forums: a developer using SpawnProp to spawn a prop noticed the result it hands back is typed ?creative_prop — a question mark out of nowhere in front of the name. What type is that? Epic staffer Kurtis Schmidt's answer settled it in one stroke: a question mark in type position means this is an option type — a box that "may hold one value, or hold nothing at all", just like those object references in Blueprint that might be valid or might be empty.
Why is SpawnProp designed this way? Because spawning a prop is a thing that can inherently not work out: bad location, wrong asset… Rather than shoving at you an empty reference that throws Accessed None the moment you touch it, it uses ?creative_prop to say it straight: "what you're holding might be a prop, might be an empty box — check before you unwrap." It's one more place where Verse makes you check first and use second, right at the source (for SpawnProp's exact signature, defer to the Verse API Reference).
2. Identity One: ?type — a Box That Might Have Cargo
Put ? in front of a type and you get that type's option version: ?int is "a box that might hold a whole number". An empty box is written false, stocking it uses option{value}, and unboxing goes to the old friend you met in Lesson 13 — the postfix ?, done in a Branch-style check position:
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Diagnostics }
mystery_box_device := class(creative_device):
# ? in type position: option type — the box might hold an int, or be empty
var MaybePrize:?int = false
OnBegin<override>()<suspends>:void =
set MaybePrize = option{500}
# postfix ? in expression position: unboxing, done inside a failure context
if (Prize := MaybePrize?):
Print("Unboxed! A prize of {Prize} coins")
else:
Print("The box is empty")
Graph translation: first create MaybePrize in the variables panel, typed "box that might hold an integer", initially empty (false). In BeginPlay, one Set puts 500 into the box, then one Branch opens it: if MaybePrize? gets something out (box not empty), the value is named Prize and the success pin Prints the prize; if not, the else path Prints "empty".
Note the division of labor between these two question marks: the one in ?int is a type annotation, describing the box's model; the one in MaybePrize? is the box-opening move, an action that might succeed or might not go through. One position apart in spelling, entirely different identities.
3. Identity Two: ?Name — a Parameter You May Leave Out
In the same answer, Kurtis Schmidt added the question mark's second use: written before the name of a function's input parameter, it marks an optional named parameter, which can carry a default value — a bit like an input pin on a Blueprint node: leave it unwired and it uses the default filled into the pin. At the call site you can either leave it out, or pass it in by name:
using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Diagnostics }
cheer_device := class(creative_device):
# ? in parameter position: optional named parameter — defaults to 1 if omitted
Cheer(?Times:int = 1):void =
Print("Let's go x {Times}!")
OnBegin<override>()<suspends>:void =
Cheer() # parameter omitted, Times = 1
Cheer(?Times := 3) # passed by name, Times = 3
Graph translation: Cheer is a custom Blueprint function with one optional input, Times, defaulting to 1. BeginPlay calls it twice: the first Cheer() fills nothing in, so the default 1 kicks in; the second Cheer(?Times := 3) names the input and sets it to 3.
Line all three faces up in one cheat sheet — whenever you meet a question mark, check where it's standing first:
| Position | Looks like | Meaning |
|---|---|---|
| Expression postfix | HasKey?, MaybePrize? |
Queries a logic (Boolean) / unboxes an option; might not go through, must sit in a Branch-style check position |
| Type prefix | ?int, ?creative_prop |
Option type: might hold a value, might be empty |
| Parameter-name prefix | ?Times:int = 1 |
Optional named parameter — may be omitted at the call site |
4. Pop Quiz ★
In the line var Slot:?agent = false, what does the ? before the type mean?
This page is adapted from an Epic developer forums Q&A; Epic staffer Kurtis Schmidt's answer is in the original thread: Types prefixed by a "?" — Unreal Engine Forums ↗