Switch devices can be operated by users to turn devices on or off, or as a game mechanic to start or stop other devices.
Simple Light Switch Mechanic
One basic use of the Switch device is as a light switch as it can be easily configured to turn other devices on and off.
Devices Used
1 x Player Spawner device
2 x Customizable Light (Torch) devices
1 x Switch device
Set Up the Devices
Place the Castle Cellar prefab building.
Place a Player Spawner device outside the door.
Place a Switch device inside the building.
Customize the switch:
Option
Value
Turn On Text
Turn On Lights
Turn Off Text
Turn Off Lights
Device Model
Antique Lever (Unlit)
Place two Customizable Lights (Torch) devices.
Customize the lights:
Option
Value
Description
Initial State
Off
Brightness Scale
1.0
Turn On Team
None
Makes it so that players cannot directly interact with the Lights.
Turn Off Team
None
Makes it so that players cannot directly interact with the Lights.
Bind Functions and Events
Direct event binding is how you set devices to communicate directly with other devices. This involves setting functions and events for the devices involved.
Configure the following events on the switch:
Event
Select Device
Select Function
On Turned On
Torch, Torch2
Turn On
On Turned Off
Torch, Torch2
Turn Off
You now have the basic functionality for players interacting with lights using the Switch device!
Design Tip
You can connect a switch to any device. These are useful in turning different devices on and off! A switch can be easily used to open and close a door remotely, trigger the movement of a prop, or enable or disable a vehicle.
Build a Persistent Tutorial Manager
The Switch device can be configured to save its state between playthroughs, allowing for very basic and straightforward data saving.
In this example, you will use a switch to create a system that automatically skips a tutorial if the player has completed it before.
Devices Used
1 x Switch device
1 x Player Spawner device
1 x Item Granter device
1 x Creature Spawner device
2 x Player Checkpoint devices
2 x Teleporter devices
1 x Trigger device
Set Up the Basic Gameplay
You’ll begin by setting up the basic play area and gameplay functionality.
Create a play area with pieces from the Obstacle Course Gallery Blue Gallery.
Make sure the area has distinct sections for the tutorial and gameplay segments.
Place a Player Spawner device in another area of the map that the player will see during the starting countdown.
Place an Item Granter device and register a Legendary Tactical Assault Rifle to the device.
Customize the item granter:
Option
Value
Receiving Players
All
Spare Weapon Ammo
999
Grant on Game Start
On
Place a Creature Spawner device in the tutorial area, and customize it.
Option
Value
Creature Type
Fiend
Activation Range
3.0 Tiles
Max Spawn Distance
1.0 Tiles
Configure the Different Start Points
You’ll now use the Teleporter and Player Checkpoint devices to configure starting locations for the tutorial and gameplay segments.
Place a Player Checkpoint device at the beginning of the tutorial segment, and customize it.
Option
Value
Visible In Game
Off
Play Activate FX
Off
Place a Teleporter device on top of the player checkpoint and customize it.
Option
Value
Teleporter Rift Visible
No
Play Visual Effects
No
Play Sound Effects
No
Copy these two devices and place another pair at the beginning of the Gameplay segment. Rename them accordingly.
Customize the new Gameplay Teleporter device.
Option
Value
Description
Teleporter Group
Group B
This ensures that the two Teleporters are not connected to one another and will only teleport the player on events.
Teleporter Target Group
Group B
This ensures that the two Teleporters are not connected to one another and will only teleport the player on events.
Teleporter Rift Visible
No
Play Visual Effects
No
Play Sound Effects
No
Set Up the Persistent Switch
Now, set up a switch to keep track of whether the player has completed the tutorial, and to save the data.
Place a Switch device and customize.
Option
Value
Visible During Game
No
Use Persistence
Use
Auto-Save
Yes
Auto-Load
Game Start
Place a Trigger device in the doorway at the exit of the tutorial segment and customize.
Option
Value
Visible In Game
Off
Times Can Trigger
1
Trigger VFX
Off
Trigger SFX
Off
Bind Functions and Events
The next step is to bind the functions and events.
Configure the following event on the Player Spawner device, ensuring that the switch checks its state on game start.
Event
Select Device
Select Function
On Player Spawned
Tutorial Switch
Check State
Configure the following events on the switch to send the player to the correct location and set their respawn location at the beginning of the game.
On Check Result On
Gameplay Checkpoint
Register
On Check Result On
Gameplay Teleporter
Teleport
On Check Result Off
Tutorial Checkpoint
Register
On Check Result Off
Tutorial Teleporter
Teleport
Configure the following events on the Trigger device to update the player’s respawn point and save their tutorial progress when they complete the tutorial segment.
On Triggered
Gameplay Checkpoint
Register
On Triggered
Tutorial Switch
Turn On
You now have the basic functionality for a system that uses a switch to track whether a player has completed a tutorial!
Design Tip
This example showcases a Persistent Tutorial Manager in a single-player context, but the persistence functionality on the switch can easily be used for multiplayer games as well.
For each player to have their own unique switch, make sure the Store State Per Player setting is on Yes. This would be great in Islands where different players can enter the game at different times, making sure that each is able to interact with the tutorial on their own.
Build a King-of-the-Hill Game!
The Switch device can be used as an interactable objective in a two-player King-of-the-Hill game!
In this example, you will use a Switch device to represent which player is in control of the hill. If On, the Blue Team is in control. If Off, the Red Team is in control.
Devices Used
1 x Switch device
2 x Player Spawner devices
2 x
Team Settings & Inventory devices2 x End Game devices
3 x Timer devices
16 x Customizable Light (Spotlight) devices
6 x VFX Spawner devices
2 x Skydome devices
2 x Channel devices
Set Up the Play Area and Basic Devices
Create a play area with a large hill in the center using pieces from the Obstacle Course Gallery Black and Obstacle Course Gallery Grip Tape galleries.
Add spawn areas for each team using pieces from the Obstacle Course Gallery Blue and Obstacle Course Gallery Red galleries.
Place a large Switch device on the top of the hill and customize.
Option
Value
Enabled at Game Start
No
Turn On Text
CHANGE TO BLUE
Turn Off Text
CHANGE TO RED
Device Model
Antique Lever (Unlit)
Place a Timer device to create a delay before the switch activates at the beginning of the game and customize it.
Option
Value
Duration
10.0 Seconds
Timer Name
Game Start
Start at Game Start
On
Can Interact
No
Visible During Game
HIdden
Timer Color
White
Display Time In
Seconds Only
Timer Running Text
Hill Active In…
Place an Item Granter device and register a Legendary Tactical Assault Rifle to the device.
Customize the device.
Option
Value
Receiving Players
All
Spare Weapon Ammo
999
Grant on Game Start
On
Configure the Two Teams
Place a Player Checkpoint device in the blue spawn area and customize it to Team 1 (the Blue team).
Place a Team Settings & Inventory device in the blue spawn area, and customize it.
Option
Value
Team Name
Blue
Team
1
Team Color
Sky Blue
Place an End Game device in the blue spawn area and customize it.
Option
Value
Winning Team
Team 1
Custom Victory Callout
Blue Wins
Place a Timer device in the blue spawn area, and customize it.
Option
Value
Duration
20.0 Seconds
Timer Name
Blue
Can Interact
No
Visible During Game
Hidden
Timer Color
Sky Blue
Display Time In
Seconds Only
Timer Running Text
BLUE WINS IN…
Timer Label Text Style
Blue
Enable Urgency Mode
On
Urgency Mode Time
5.0 Seconds
Copy the devices placed in this section and place the duplicates in the red spawn area. Update the settings on the devices for Team 2 instead of Team 1 and Red instead of Blue where applicable.
Set Up the VFX
Place 16 Customizable Lights (Spotlight) devices along the top of the hill, and customize them.
Option
Value
Activate on Phase
Game Start
Brightness Scale
1.0
Color
White
Color Change Time
Instant
Turn On Team
None
Turn Off Team
None
Place two VFX Spawner devices at the top of the hill. Customize each spawner to your liking, with one set for blue and one for red. Make sure the spawners are set to Enabled on Phase at None.
Place four additional VFX spawners on the sides of the hill. Customize each to your liking, with one on each side for blue and one on each side for red.
Place two Channel devices, one for blue and one for red. These will streamline our direct event binding for the VFX in the next section.
Bind Functions and Events
Configure the following events on the Game Start Timer device to enable the switch after a 10-second starting delay.
Event
Select Device
Select Function
On Success
Switch
Enable
Configure the following events on the Blue Timer to make the Blue Team win if the timer reaches 0.
Event
Select Device
Select Function
On Success
Blue End Game Device
Activate
Repeat the previous step with the red timer and Red End Game device.
Configure the following events on the Blue Channel device to trigger the VFX changes when the channel is triggered.
Event
Select Device
Select Function
On Received Transmit
Light-Light16
Set to Team Color
On Received Transmit
Red VFX Spawner1-3
Disable
On Received Transmit
Blue VFX Spawner1-3
Enable
Repeat the previous step with the Red Channel. Configure it so that it disables the Blue VFX Spawners and Skydome, and enables the Red VFX Spawners and Skydome. Leave the light events the same.
Configure the following events on the switch to start and pause the timers and trigger the VFX channels.
Event
Select Device
Select Function
On Turned On
Blue Timer
Start
On Turned On
Blue Timer
Resume
On Turned On
Red Timer
Pause
On Turned On
Blue VFX Channel
Transmit
On Turned Off
Red Timer
Start
On Turned Off
Red Timer
Resume
On Turned Off
Blue Timer
Pause
On Turned Off
Red VFX Channel
Transmit
You now have a fully functioning King-of-the-Hill game!
Design Tip
This example is configured for just two players, but you could add more player spawners to accomodate a larger battle.
When adding more players, make sure the play space is large enough to accommodate many interactions at once, and tune the amount of time it takes players to respawn to keep the gameplay engaging!