1
\$\begingroup\$

100% not a graphics guy here.

Problem Demonstration.

Randomly discovered this when showing the project to a friend after not touching it for over a month (been working on other stuffs). First I noticed that either the flashlight was super dim, or the main material of the room was a tad darker than it should be: things weren't being illuminated enough by it. Then I noticed that in this small pillar setup the spotlights aimed down at the pillars weren't working, at all. Upon tinkering I discovered that they were working after all, but only at specific ranges/distances/angles/whatevers. No idea what triggered this: the first backup without this glitch was made in the middle of some basic level design work. The project uses built-in RP, Unity 2021.3 (originated in 29, updating to 31 changed nothing).

I would love to save this project. Since it is to become much bigger (hopefully), in case this happens again I need a better solution (and understanding of wtf happened) than just carefully rebuilding everything one asset at a time in a new project. Without one, I might as well switch engines now, but I'm trying to avoid that for this one last Unity project because time and laziness.

  • As far as I can tell, all project settings between that one perfectly working backup and the latest messed up version are identical;
  • Material settings are identical;
  • Point lights work as expected, I believe, but as was discovered with the flashlight, it seems lighting in general isn't quite working as it was set up. Kinda like what happens when you switch to URP from setting everything up in built-in RP;
  • Newly created spot lights in this project work in the same flickery fashion;
  • Exporting the entire project and importing it into a new one doesn't help, so I assume the problem is tied to one of the assets..? However -->
  • Removing all optional packages didn't help;
  • Removing all other objects from the hierarchy didn't help;
  • I assume I am missing something stupidly obvious and ready to absorb the knawledge (☝️).

EDIT. Nope, no idea. I ended up putting a band-aid on it: adjusted the ranges to random values at which the lights randomly start working (works fine for now but would be very annoying to create new things with this bug around). About time I switched to Unreal anyway: not interested in paying Unity taxes. Big thanks to everyone who tried to help!

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Did you by chance have it working in the scene loading directly correctly but it is wrong when you load a second scene (switching to a second one) from the first one? \$\endgroup\$
    – Zibelas
    Oct 29, 2023 at 19:31
  • 1
    \$\begingroup\$ For things I would check - have you rebuilt lighting in the newer project? That generally should help fix it, at least in my experience - especially if newly created lights have the same issue. Alternatively, checking that there's not something blocking the light source would be my next guess - if you added a slotted mesh during level design, or some odd object, it could be causing an eclipse-like effect. \$\endgroup\$ Oct 30, 2023 at 9:44
  • \$\begingroup\$ Are you using forward or deferred rendering for the opaque objects? Forward rendering tries to bin lights by importance, and only draw the ones with the most effect on each object, so it could be something is confusing that check and leading it to cull important lights. Check the range/bounds on your lights and keep them as small and tight as they can be (adjusting the intensity to compensate) to reduce errors. Or try turning off all lights but one and see if the issue persists. \$\endgroup\$
    – DMGregory
    Oct 30, 2023 at 11:35
  • \$\begingroup\$ @Zibelas Interesting suggestion! I only have one scene, so in both versions it loads directly (if I understood you correctly), but creating an additional one just to see if switching between scenes somehow cures this doesn't sound too un-unity to me anymore \$\endgroup\$
    – memorylick
    Oct 31, 2023 at 3:11
  • 1
    \$\begingroup\$ @Alexander-The-1st I am 100% sure I have tried turning off everything else in the scene... it would be rather embarassing if I somehow missed an object or two. I will definitely triple check tho. will report tomorrow if I tinker my way into any discoveries. thank you for your brain power \$\endgroup\$
    – memorylick
    Oct 31, 2023 at 3:27

1 Answer 1

0
\$\begingroup\$

The solution is to put a band-aid on it temporarily: either avoid using spot lights or adjust their ranges to values where they randonly start working (as long as the objects/lights don't move around you'll be fine), and then either keep working with this in mind or switch to Godot or Unreal.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .