Transition from 4.8.0 to 4.8.1 causes Lighting-needs-rebuild-error (during game-play only) everytime project is opened, even after several successful rebuild attempts
I am facing the infamous - "Lighting needs rebuild" error during game-play, and unfortunately it is not the standard - click the Build button - issue. Sorry if this post is long, but I have tried several things and went through many posts, but nothing seems to solve this error. So I decided to post my problem in detail.
I have been using the UE4 ShooterGame sample as the base template for my game (solely for the FPS player pawn and weapons systems - NOTHING ELSE is used). I began with v4.5.1 and created a new map consisting of a large forest - so it makes heavy use of the foliage system and also has a post-processing volume.
(A note to Epic: if using the ShooterGame as a base template is not permissible please do tell me.)
Whenever a major version release was made since 4.5.1, I did the following to stay up to date with the latest ShooterGame code:
1.1. Download & create a new project of the compatible ShooterGame version in a new directory
1.2. Migrate the entire map I created from the previous ShooterGame to this newer one
1.3. Compile & Build the newer version
1.4. Run it (in editor & launch mode) to check if it's fine
1.5. Keep working if everything is OK
Everything worked fined up until 4.8.1. Even the major release for 4.8.0 transition was without errors. But after updating to 4.8.1 I keep getting the "Lighting needs to be rebuilt" error.
2.1. The error only occurs when playing the game (whether within the UE4 editor or in launch mode)
2.2. Oddly, while working on the game from within the editor (not playing) the error does not display at all
The common solution stated is to rebuild the project (click the Build button). However, this is what happens:
3.1. Click on Build button (build all, not just light)
3.2. Build completes successfully
3.3. Save the project
3.4. Click on Play button and run from within editor
3.5. NO error messages in-game
3.6. Close project (exit editor)
3.7. Editor prompts to save all levels before exiting - click YES
3.8. Open project again
3.9. NO error messages displayed within the view-port window
3.10 Click on Play button and run from within editor
3.11. "Lighting needs to be rebuilt for XXX objects" error displayed in-game
3.12. Stop the game
3.13. NO error messages displayed within the view-port window
3.14. Again click on Play button and run from within editor
3.15. "Lighting needs to be rebuilt" error still displayed in-game
3.16. Stop the game
3.17. NO error messages displayed within the view-port window
Figure A - No error while modifying game in editor
Figure B - Error while playing game in editor
If I build project again the result is steps 3.1 through 3.17 all over again, no matter how many times I build the project.
I have also tried the following:
4.1. Verified that all foliage instances have a lightmap-resolution value of 8 (least possible I assume) then rebuild
4.2. Deleted the foliage instances completely and then rebuild
4.3. Deleted entire project and recreated the project using the steps mentioned at the very top of this posts (1.1 - 1.4) - when I had first done this with 4.8.0 it was fine, but now that the engine is 4.8.1 the error is there right after project creation and map transfer.
4.4. Printed to the log output the list of Actors that are causing the error, deleted them, and rebuild (reference post - https://answers.unrealengine.com/questions/206293/maps-need-lighting-rebuilt.html)
Nothing seems to get rid of this error. I even build & played a backup of the previous version project (4.7.6) that I saved - everything is fine in 4.7.6. It appears there's a lot more to lighting being built then just clicking the Build button.
I would appreciate it if someone could help me with this problem.
I finally found a solution! This is going to be really weird to explain. In my case I found 2 reasons why this error was occurring:
1. Blueprint Actors with Errors in Constructors
Some Blueprint Actors had deprecated and/or invalid nodes in their 'Constructor' code. The deprecated nodes showed up as a warning and was easy to fix. But as for the invalid nodes, they didn't compile as an error, nor a warning. These nodes were trying to set a property for some components that in the blueprint I had recently deleted. (sorry - lost the reference thread where I found the solution for this point)
2. Actors with Static-Light (Baking/Building) Errors
Print the objects that are having light-building errors by entering the console command 'DumpUnbuiltLightInteractions' in-game. The output is printed to the 'Output-Log' panel which you can open from the 'Windows -> OutputLog' menu.
(Reference thread: https://forums.unrealengine.com/showthread.php?69681-Lighting-quot-always-quot-needs-to-be-rebuilt - look for comment by DanielW)
Some - NOT ALL - of the objects printed by the 'DumpUnbuiltLightInteractions' command are responsible for this error. The only way I was able to find the invalid ones was to delete one by one each of the objects listed in 'DumpUnbuiltLightInteractions' command output and check if the error message still persists. I didn't have to rebuild every time I delete an object. Once the objects responsible for the error were deleted the error message disappeared from the 'Viewport' panel automatically.
The weird thing is, aside from the invalid blueprint-node, everything else - even the objects under point #2 - did NOT cause any errors in versions of UE prior to v4.8.1. My best guess would be that something happened internally when I migrated the map from the older project to the newer one.
I have seen posts that had these 2 same reasons - independently - as the cause for the 'lighting-needs-rebuild' error. So I guess these 2 points could be common causes, and tackling them this way could be part of a common solution.
Anyway, hope these two points might help anyone else facing this same dreadful error.
answered Aug 17 '15 at 09:55 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here