How do I create flashing lights/materials using Blueprints like this “code”?
While (KeyPressed =True)
Do
SetMaterial(Yellow255)
Delay(1 second)
SetMaterial(Yellow063)
Delay(1 second)
Loop
Wend
How do I create flashing lights/materials using Blueprints like this “code”?
While (KeyPressed =True)
Do
SetMaterial(Yellow255)
Delay(1 second)
SetMaterial(Yellow063)
Delay(1 second)
Loop
Wend
The guy has plenty of really good tutorials to learn blueprint. Here is his blinking light tutorial.
You could use a dynamic material instance with a color param and timeline. Example:
Make a new material, name it “M_BASE_BLINK”
1a) Edit the material and plug [Vector Param]¤~¤[Base Color]. Name the parameter “Base Color”
Use Construction Script to apply a dynamic material from the base material
2a) Open your blueprint’s “Construction Script”
2b) Add a variable type “MaterialInstanceDynamic” and name it “MID”
2c) Do Construction>~>Create Material Instance Dynamic (M_BASE_BLINK)>~>Set (MID)>~>Set Material (Mesh¤~¤Target | MID¤~¤Material)
Create a timeline to control the color/blink speed
3a) Open your blueprint’s “Event Graph”
3b) Right-click in the graph and choose “Add Timeline”, then double-click the new timeline to edit it
3c) Click the big “C” button to add a Color Track, check the “Use last keyframe?” and “Loop” checkboxes
3d) Near the 0.00 frame, click in the thin dark-gray area just above the color strip to add a new keyframe
3e) Right-click the new keyframe to edit the time (make it 0.0) and the set the color to bright yellow
3f) Add another keyframe at the 1.0 mark and set its color to dull yellow
Back to the Event Graph (I used Overlaps instead of Key Press Events)
4a) Plug Key Pressed Event>~>Play From Start
4b) Plug Key Released Event>~>Stop
4c) Plug Timeline Update>~>Set Vector Parameter (the MID version)
4d) BlinkLight¤~¤Target and the Timeline Track¤~¤Value
That should do it.
I know this is an old post but i just wanted to say thank you DoteDote for the above explanation on how to do this. I learned a new technique with the timeline graphs using the color nodes and scalar nodes which allowed me to make my skyscraper lights to place on top of buildings. you rock and make this place better for all!