Example: Custom Blueprint Switch
UE5 Time of Day Blueprint System Version: 2.0There may come a time when you would like some of your own custom blueprints in your level to simply turn on or off at different points in the day, like showcasing a gravity defying cupcake with spinning spotlights that starts at 5:47 PM and stops at 4:45 AM …
In the cupcake showcase example in the demo world the cupcake transitioning in and out is our custom blueprint, but we are also controlling the two spotlights which are additional blueprints. The rotating of the ceiling the lights are attached to is handled inside the custom blueprint. The controlling of all 3 of these blueprints is handled using the Remote BP Switch.
The Remote BP Switch, BP_TimeOfDay_SwitchRemoteBP, can be found in the Blueprints/Utilities/ folder. To use it just drop a copy of the Remote BP Switch blueprint into your level, near the custom blueprints you would like to control.
Configure the Remote BP Switch
The remote bp switch is an advanced example, and while it might be tempting to jump right to it if you are having trouble understanding the configuration settings take a look at some of the other switch examples, under the surface they all work the same, and have similar configuration setups.
Configure Custom Blueprints to work with the Switch
To configure your custom blueprint to listen for the Turn On and Turn Off calls from the Remote BP Switch we use a blueprint interface. Simply add this blueprint interface to your custom blueprint by selecting the Class Settings button on the menu bar then from the Implemented Interfaces section click the Add button and select the BPI_TimeOfDay_SwitchRemote interface. This will then add 2 events to the “interface” section of your MyBlueprint panel.
From this Interface section double click on the TurnOn and TurnOff events to implement them into your blueprint. This will create the new events in your custom blueprint’s event graph. From here is how the switch will tell your custom blueprint what it needs to do when it turns on and off.