# light on and off ,getting closer

**URL:** <https://forums.unrealengine.com/t/light-on-and-off-getting-closer/143814>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [May 17, 2020, 9:03am UTC](https://forums.unrealengine.com/t/light-on-and-off-getting-closer/143814 "2020-05-17T09:03:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_461d3d711](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_461d3d711](https://forums.unrealengine.com/u/anonymous_user_461d3d711)\
**Post date:** [May 17, 2020, 9:03am UTC](https://forums.unrealengine.com/t/light-on-and-off-getting-closer/143814/1 "2020-05-17T09:03:15Z")

</div>

Hi

I try to make the blueprint that turn on and off the pendant light.(attachment jpg “01"and"04”)

I want to have the two materials in the pendantlight, the frame of that has black metal and lightbulbs have glowing white materials.

And If FirstPerson get closer to the pendant light,I want to light turns on.

Like the attachment files I make the blueprint,It worked well done except for one point.(attachment jpg “02”)

The bulbs with the pendant light have multiple meterial elements in the material slots.

Lightbulb glowing material should have been just one ,but two same materias have done.

“Element index” of the "Set Material " in the blueprint can’t only set one element index.(attachment jpg “03”)

I want to turn on and off both of the element one and the element two.

because,there are two same materials “lightbulb”.

I 'd like to set two element index (1and2),and so all the bulb can light on and off .

Of course,in the DCC tool It should be fixed,if you can ,I would like to be possible in the blueprint.

Please tell me something good suggestion.Could you help me?

Sorry ,I’ m not good at english.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 17, 2020, 10:44am UTC](https://forums.unrealengine.com/t/light-on-and-off-getting-closer/143814/2 "2020-05-17T10:44:04Z")

</div>

> [@anonymous\_user\_461d3d711](#):
>
> Hi
> 
> I try to make the blueprint that turn on and off the pendant light.(attachment jpg “01"and"04”)
> 
> I want to have the two materials in the pendantlight, the frame of that has black metal and lightbulbs have glowing white materials.
> 
> And If FirstPerson get closer to the pendant light,I want to light turns on.
> 
> Like the attachment files I make the blueprint,It worked well done except for one point.(attachment jpg “02”)
> 
> The bulbs with the pendant light have multiple meterial elements in the material slots.
> 
> Lightbulb glowing material should have been just one ,but two same materias have done.
> 
> “Element index” of the "Set Material " in the blueprint can’t only set one element index.(attachment jpg “03”)
> 
> I want to turn on and off both of the element one and the element two.
> 
> because,there are two same materials “lightbulb”.
> 
> I 'd like to set two element index (1and2),and so all the bulb can light on and off .
> 
> Of course,in the DCC tool It should be fixed,if you can ,I would like to be possible in the blueprint.
> 
> Please tell me something good suggestion.Could you help me?
> 
> Sorry ,I’ m not good at english.

Just make 2 dynamic materials:

 ![Capture.JPG](https://d3kjluh73b9h9o.cloudfront.net/original/3X/6/7/67f012e5c047b50c8039d5d1ca584c4b37199610.jpeg)

![2mat.gif](https://d3kjluh73b9h9o.cloudfront.net/original/3X/1/b/1b13e29ef5200a36cd4530bf2236bdc8f6946375.gif)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_461d3d711](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_461d3d711](https://forums.unrealengine.com/u/anonymous_user_461d3d711)\
**Post date:** [May 18, 2020, 1:23pm UTC](https://forums.unrealengine.com/t/light-on-and-off-getting-closer/143814/3 "2020-05-18T13:23:48Z")

</div>

Hi!  
Thank you so much,I’m grateful.I’m closer to doing what I want to do.  
Certainly,I did say that I get closer to the pendant light.  
But exactly when I pressed the L key,I wanted to turn on and off.  
Therefore I’m setting flip flop ,so I press the L key to switch between the two.  
What can I do to add this flow to your suggestion?  
I’m not programmer,so I 'm not good at blueprint.  
Please help me.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 22, 2020, 7:10am UTC](https://forums.unrealengine.com/t/light-on-and-off-getting-closer/143814/4 "2020-05-22T07:10:23Z")

</div>

> [@anonymous\_user\_461d3d711](#):
>
> Hi!  
> Thank you so much,I’m grateful.I’m closer to doing what I want to do.  
> Certainly,I did say that I get closer to the pendant light.  
> But exactly when I pressed the L key,I wanted to turn on and off.  
> Therefore I’m setting flip flop ,so I press the L key to switch between the two.  
> What can I do to add this flow to your suggestion?  
> I’m not programmer,so I 'm not good at blueprint.  
> Please help me.

Then use the same BeginPlay as above, but also:

 ![bp.JPG](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/0/c06bb5fa0d26feb6289e4940395f891778941514.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_461d3d711](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_461d3d711](https://forums.unrealengine.com/u/anonymous_user_461d3d711)\
**Post date:** [May 27, 2020, 3:47am UTC](https://forums.unrealengine.com/t/light-on-and-off-getting-closer/143814/5 "2020-05-27T03:47:56Z")

</div>

Thank you for all your help.  
I can’t think of that you put two variable “Mat” in the Target of Set Scalar parameter Value.  
I’ll try it.
