The project I’m currently working on incorporates a flashlight mechanic, which I’m generating with a prefab model flashlight and a spotlight attached with a range of 100, spot angle 50, intensity and indirect multiplier both set to 1. Sticking with the default white for the color for now, though will probably play around with more of a yellowish color later. As I’ve been testing it out, I’ve noticed a few bugs that I can’t figure out how to get around, so hoping someone might have some insight! I’m working in Unity 2021.3.20f1.
- The closer I am to an object, the smaller the lighted area becomes, which yeah, it technically should, but this seems extreme. See image 1 attached - that tiny little white dot on the wall is the light beam, and doesn’t even line up with where the flashlight is pointing (though, I’ll settle for living with that last bit, if I can get the area issue fixed).
- There are certain walls where if I shine the flashlight on one section of the wall, the entire wall lights up instead of just the one section. See images 2, 3, & 4 attached - in image 2, you can see that the wall on the left is fully lit up, even though the beam is only slightly touching that wall; image 3 shows where I moved the beam slightly to the right, so that it is not touching the left, and the wall is in its natural darkened state. Image 4 shows an even weirder iteration of this glitch (but demonstrates it pretty well) - On the roof, I actually have 3 different cubes lined up to construct the roof in order to make the whole for the ventilation shaft. The two thinner cubes (to the right and left of the vent shaft) I used the same texture but with a different material and tiling in order to make the three cubes blend more naturally. But when the light is shined on either of the thinner cubes, it lights up the entire cube (I only shined it on the left cube in this example for illustration). The only difference between the two materials used is the tiling (and of course their scaling), yet one lights up entirely, and one doesn’t light up at all! WTF??
- Lastly (and this is probably the one that bugs me the most), part of the game involves crawling through the aforementioned vent shaft (if there’s going to be a vent shaft in the game, obviously you’re going to be crawling through it at some point, lol). However, I have noticed that when in the vent and utilizing the flashlight, the direction I am facing affects how well the flashlight lights my path. EG, if I’m facing “North” or “West”, it doesn’t light my way at all (in image 5 attached, I am facing due “North”). But if I’m facing “South” or “East,” it lights my way perfectly (image 6 is me standing in the exact same position as image 5, but facing due “South.”
Any ideas anyone might have on figuring out what I’m doing wrong on these (3 is probably the most crucial that I want to resolve, where as 1&2 are annoying but I could live with them if I have to).





