Hi, can you tell me how I can create a light object during the game? I want to add light to my character’s point by pressing a button, but nothing works
Create an object in the actions, when the event is called
I do, but it’s with Light that it doesn’t work. But when I do the same with any other sprite everything works
Maybe you’re not creating the object in the appropriate layer?
I create light in a special layer, as well as tried in other layers. But for some reason, creating a new light object only works if the scene is initially loaded. But I would like to create a light in the process of passing the game
Is the lighting layer in the scene?
To check, click the layers icon at the top right ()
and see that it is listed in the Layers window, with the lightbulb icon :
If it’s not there, add it by clicking the down arrow on the Add A Layer button.
If you do have the lighting layer, then can you provide a screen snip of the events you use to create the light?
I have a lighting layer, maybe I’m somehow calling the event wrong, but the flag object is created at the right point, and the flagLight is not created
You don’t have to put the light object on the lighting layer, though that won’t be the issue.
Do you have a light blocking object? If not, what happens if you drag the flagLight onto the scene in the editor (so it’s on the screen at game start-up) and play the game?
I’m trying to create light in a room where other light sources are already working. if you put a flagLight on the scene it works
And what about my other question - do you have a light blocking object?
Added LightObstacleBehavior to the walls and floor
Hmmm, I’m a bit stumped. There was a bug for light objects if there’s a light blocker covering 0,0. Not sure if it’s been fixed.
If there’s no light blocker on (0,0), would you mind sharing your project so we can see what’s going on?
I just did the same thing in a new project, and it works. But it doesn’t work in my main project. I also tried to create a new light object, but it didn’t help
Are all the light layer settings the same between the two projects? Are all the light object settings the same?
Does the same happen if you create a new scene? And what if you duplicate the scene?
Sorry for the long break. Duplicating the scene didn’t help, but when I deleted all the objects of the scene and set them up again, everything worked. Although I’m not sure if that was the problem. Thanks for the help.