This tutorial is a simple flashlight integration to the player with button switch to activate/deactivate a torch for the player character.
This step is to create a new input mapping that can be used to turn the flashlight on/off
In the content folder create a new "Input Mapping" name it AI_Flashlight
Open it (Double click)
Add a new array element and change it to pressed
Open up your Input mapping context (This should be in your character inputs folder)
Add a new mapping by pressing the plus icon, add your AI_Flashlight in the drop down
In the dropdown underneath that you can add your button press to what you want you flashlight on/off switch to be (Mine is keyboard F)
Save
Open your character blueprint
In the view-port add a spotlight
Change the position of the spotlight to your desired location
In the details section you can change the lights intensity/colour/etc
On the flashlight turn the visibilty off by default
If you would like the light to follow the camera rather than the player, attach the light to the camera boom in the components hierarchy (Drag the Spot Light onto your Camera Boom in the hierarchy to make it a child of the boom).
Go to the event graph
Follow the instructions in the image
Ensure you have set the visibility correctly
Compile and save
Your flashlight should now work when when turning it on/off