Class Designer: How to Spot Your Squad with `GetClassMembers`
Class Designer: How to Spot Your Squad with GetClassMembers
Ever wanted to build a trap that only triggers if specific players walk into it? Or a healing station that only works for your teammates and leaves enemies to wither? That’s where the Class Designer Device comes in. It’s the referee that decides who belongs to which "team" (but not the blue/orange team—your custom teams).
In this tutorial, we’re going to build a "VIP Lounge" system. Only players wearing the "VIP" class get in; everyone else gets a gentle but firm shove back. We’ll learn how to use GetClassMembers to check who is in the club, and why knowing your scene graph hierarchy matters more than your K/D ratio.
What You'll Learn
- The Class Designer Device: How to tag players with custom labels (like "VIP," "Enemy," or "Loot Goblin").
GetClassMembers: The Verse function that acts like a bouncer checking the guest list.- Scene Graph Hierarchy: Why your code needs to know where the device is in the world.
- Agent Groups: The invisible container that holds all your players together.
How It Works
1. The "Class" vs. The "Team"
In Fortnite, you have Blue and Orange teams. In Verse, you have Classes. Think of a Class like a Role or a Skin Category.
- Team: A pre-defined group (Blue/Orange) used for combat.
- Class: A custom label you create. You can have a player be "Blue Team" but have the Class "VIP," while their enemy is "Orange Team" with the Class "Grunt."
2. The Class Designer Device
This device is your Tagger. You place it in your island editor, and you tell it: "When Player A touches this, they become a VIP. When Player B touches that, they become a Grunt." It doesn’t move players; it just updates their internal "label."
3. GetClassMembers: The Guest List
Now, imagine you built a VIP Lounge. How does the door know who to let in? You need to ask Verse: "Hey, who is currently a VIP?"
That’s what GetClassMembers does. It’s a function that looks at the Class Designer Device and returns a list (an array) of all agents (players) who currently have that class assigned.
Game Analogy: Imagine the Class Designer is a Lobby Manager holding a clipboard.
GetClassMembersis you asking, "Manager, who has a gold pass?" The manager looks at the clipboard and hands you a list of names. If the list is empty, nobody’s in the club.
4. Scene Graph: The Family Tree
In Unreal Engine 6 (and Verse), everything is part of a Scene Graph. Think of this as a family tree or a folder structure in your computer.
- Parent: The main island container.
- Child: Your VIP Lounge door.
- Grandchild: The Class Designer Device inside the door.
When you write Verse code, you often need to reference specific devices. If your Class Designer is nested deep inside a prop, your code needs to know exactly where it is in that hierarchy. If you get the path wrong, Verse won’t find the device, and your bouncer won’t have a clipboard.
Let's Build It
We’ll build a simple system:
- A Class Designer Device that tags players as "VIP" or "Guest."
- A Verse Script that checks who is VIP.
- A Prop Mover (the door) that opens only for VIPs.
Step 1: Set Up Your Island
- Place a Class Designer Device in your island. Name it
VIP_ClassDesigner. - In its properties, create a new Class called
VIP. (You can also createGuest, but for this demo, we’ll assume anyone not tagged is a Guest). - Place a Prop Mover (this will be your door). Name it
VIP_Door. - Place a Trigger Volume (or just use a simple overlap logic). For simplicity, let’s assume players walk into a zone.
Step 2: The Verse Code
Here is the script that powers the door. Copy this into a new Verse file attached to your VIP_Door.
# Import the necessary Fortnite devices
using { /Fortnite.com/Devices }
# Define our script
VIP_Lounge_Script := agent {
# This is the Class Designer Device.
# We need to reference it so we can ask it for members.
ClassDesigner: ClassDesignerDevice = ClassDesignerDevice{}
# This is the Door (Prop Mover)
Door: PropMoverDevice = PropMoverDevice{}
# Function to check if the door should be open
IsClubOpen := func(): bool {
# HERE IS THE MAGIC: GetClassMembers
# It asks the ClassDesigner: "Who is a VIP?"
# It returns a list (array) of agents.
vip_list := ClassDesigner.GetClassMembers()
# If the list has at least one player, the club is open!
# Think of this like checking if the guest list is empty.
return vip_list.Count() > 0
}
# This event runs every frame (or tick)
OnBegin<override>() := func(): void {
# Start a loop that checks the club status
loop {
# Ask: Is anyone VIP?
if (IsClubOpen()) {
# Open the door (move it to position 1.0)
Door.SetTargetPosition(1.0)
} else {
# Close the door (move it to position 0.0)
Door.SetTargetPosition(0.0)
}
# Wait a tiny bit before checking again
# This prevents the game from freezing by overworking the CPU
Wait(0.1)
}
}
}
Walkthrough: What’s Happening?
ClassDesigner.GetClassMembers(): This is the core function. It doesn’t take any arguments. It just looks at the device it’s attached to (or referenced by) and says, "Give me everyone with the VIP class."vip_list.Count() > 0: In programming, an array is just a list..Count()tells you how many items are in that list. If the count is greater than zero, at least one VIP is in the game.loop { ... }: A loop is like a storm timer that never ends. It keeps checking the condition every 0.1 seconds. If you didn’t have theWait(0.1), the game would crash because you’d be asking the bouncer 1,000 times a second.- Scene Graph Reference: Notice how
ClassDesigneris defined as a variable. In UEFN, you usually drag-and-drop the device from the scene hierarchy into this variable slot. This links your code to the actual device in the world.
Try It Yourself
Challenge: Make the door close if a VIP leaves the island.
Hint: GetClassMembers only returns players who are currently alive and in the game. If a VIP gets eliminated, they drop out of the list. Does your IsClubOpen function still work? Test it by eliminating a VIP and seeing if the door slams shut.
Bonus Hint: If you want to get fancy, try adding a second Class called Bouncer. Use GetClassMembers for the Bouncer class too, and make the door open if either a VIP or a Bouncer is present.
Recap
- Class Designer Device tags players with custom roles (like VIP).
GetClassMembers()is the Verse function that returns a list of all players with that tag.- Scene Graph is the hierarchy that lets your code find the device in the world.
- Loops keep checking the list so your door stays open or closed in real-time.
Now go build that VIP lounge. And remember: if you don’t have the VIP class, don’t even try to pick the lock.
References
- https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/class_designer_device/getclassmembers
- https://dev.epicgames.com/documentation/fortnite/verse-api/versedotorg/agentgroup/agent_group_interface/agent_group_interface%28member_info%29
- https://github.com/vz-creates/uefn
- https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/team_settings_and_inventory_device/getteammembers
- https://dev.epicgames.com/documentation/fortnite/verse-api/versedotorg/agentgroup/add_member_error
Verse source files
- 01-fragment.verse · fragment
Turn this into a guided course
Add getclassmembers to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.
References
Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.