I have a point light. How can I disable it in the game? I need that when you go to the switch and press the enter key, so that the light source is completely turned off and the room is like in the night. But then, and upon inclusion, a rebuild of objects must occur.
Make sure your point light is set to mobility “Stationary”. Lights have the property “Affects World” that lets you turn them on and off.
Hope this helps!
That is, to make it “Mobile”? And how to implement it, the fact is that I’m a beginner and don’t know how to implement it. I mean the on, off itself. I made door opening, completely copying how it was done on video. That is, you need to enable or disable effects world in the game?
Perhaps you can somehow refer to the id of the object? How can I see the id of the light bulb and cause the effects world in the game to be disabled?
The Light should be Stationary as long as you’re not going to be moving it. The documentation says that Stationary lights cannot be moved, but can have intensity and color changed.
Now, I was wrong about using Affects World. That property cannot be edited in game.
So, what you need to do is this:
- Set your light to “Stationary”
- Make sure the light is selected in the viewport
- Open the Level Blueprint
- Right-click the graph
- Select "Create a reference to whatever your light is called
- Right-click the graph, and search “Enter”. Select the Enter event.
- Drag off of the Light Actor reference and add a “Get Light Component” node
- Drag off of the Light Component node and add a “Set Visibility” node
- Connect its exec pin to the Enter event’s On Pressed pin
- Drag off of the Light Component node and add a “Get Visible” node.
- Off of that, add a “NOT boolean” node
- Connect the output of the NOT node to the “New Visibility” pin of the “Set Visibility” node
Now, when you press Enter in the game, the light toggle.
Your final blueprint should look like this:
Probably my question is stupid, but how do I open the level blueprint?
The documentation explains usage of the level blueprint here, including how to open it:
I did everything as you said, but after I did it nothing works
What doesn’t work? The entire game? The light?
I am assuming you are saying that in that while playing the game, when you press Enter, nothing happens. And the light is stationary? Please send a screenshot of the blueprint.
I apologize, apparently I did not rebuild, thank you so much, but I still need it to work only when you come to the switch.
Add a “Trigger Volume” to your level and configure it as needed. This will be the area the character can be in where he can access the light switch. Now, make your blueprint into this:
Note, the “Trigger Volume” in the Blueprint is a reference that must be created, like the light actor before.
I also have a blue print to open doors, and when I start the game and press enter, the light turns on and off, but when I go to the door and press enter, the door starts to open and close even when I’m far from it, and the light stops working at all. I have the same button that opens the door when you approach it in the project.
What are you asking? What result do you need? I will not be able to recommend changes to your door blueprint. After all, the original question was “I have a point light. How can I disable it in the game?”
Thank you very much!!!
I think I’ll figure it out further.
What do I need to do so that others do not make the game for me, so that I myself can solve all the issues?
By the way, the only thing that does not suit me is that the light does not turn off completely, it turns off completely only after removing the light source and rebuild the objects
Is there anything you can do to turn off the light completely and turn it on?
You can try researching problems on the documentation:
However, you mainly just need to gain experience, and then you’ll be able to know what to research yourself.
You’re 100% sure your light is set to “Stationary”?
Mobility is discussed here:
I agree, I think over time I will learn how to solve all the problems myself, and there will be no such stupid questions.