The first ting is, select the mesh what you want to create a streetlight, press left click, select Asset Actions, and press right click on the Create Blueprint Using This... option.
In the popup windows select the folder what you want, and add a name for the Blueprint.
Now, open the Blueprint(Automatically open), click the Add Component menu, and select Spotlight.
Move and rotate the spotlight close to the bulb. Set mobility to static, intensity to 100 000, and visibility to false(important to the continue)
Go to Construction Script tab. Add a new Boolean variable(important! Not local variable) and set to public(eye icon)
Now, we start doing the script. First, add a Branch node, and assign the switch variable to it. The next step is add a Toggle Visibility function, and assign the Spot Light variable to it. The last step is compile and save.
Create a new map, add the Blueprint to it, and mark the switch variable on the Details panel(Right side)
Now, go to material, press a left click, and select create material instance.
Now, go back to Blueprint editor, select viewport tab, select the streetlight mesh, go to Details panel Lighting section, and mark Use emissive for static lighting checkbook.
Add a local variable, and set type to Material Instance Dynamic.
|Now, add a Set scalar parameter value function to script, drag the DMI variable to it, and set to getter. Set the parameter name to Light_Strength, or what you use on the material. Set the value to 50. Now, compile, and save.|
|If you follow my instruction, you get same result.|