Toggle light visibility with Input Action

This seems like it would be really simple, but I can’t figure it out. I just want to toggle a light on with a key press of 1 key. I have it working in the Level Blueprint, but I can not figure out why this BP isn’t working. I have a simple BP with just a point light, which is being referenced below. Am I missing something here? Thanks for any help!

Easier to enable input like this:

Will that work outside the Level Blueprint? I want to use a self contained blueprint for this…

Will that work outside the Level Blueprint? I want to use a self contained blueprint for this…

Looks like that worked! Weird, I guess the inputs just weren’t working. Thanks so much!

yep :slight_smile:

You weren’t calling the event…

Hi Clockwork, can you explain what you mean by that. I understand in theory but not sure how I would call the event to fire. Thanks again!

You had this:

328701-screenshot-2.jpg

But I was assuming you hadn’t actually called CustomEvent :slight_smile:

So you would have needed something like:

328702-screenshot-4.jpg

Interesting…I have to admit i don’t fully understand, but that’s part of the learning process. Do you mind showing me how you would setup the following…

  1. All lights in BP are not visible
  2. User presses a Key like the number 1.
  3. The light associated with that key press comes out and plays a timeline animation
  4. The user presses the same key to turn it off.

Seems pretty straightforward but I’m struggling with it. Thanks again for the help!

All I’m saying is you need to call the event which enabled input, but you didn’t. That’s why you had no input. Also, it’s easier to just set it up on the BP, like I showed. That’s all :slight_smile:

What do you want to have happen to the light on the timeline? Brightness?

So you make a light BP, it only has a point light in it. It also has one variable of type ‘key’, like this:

The code in the light is:

Then you can put as many lights in the level as you like, and give them a key like this:

( remember to enable input on the BP ).

328703-lightbp.gif

1 Like

Yep that is it exactly! I will try and recreate. Thanks so much!