I’m making a 2D top-down survival game similar to
Rimworld, I’m trying to emulate a day-night system.
Many features depend on whether any tile is light (or dark) enough, based on time of day or other light sources such as torches, so I’m wondering if there’s an easy way to detect how much light there is on a certain tile without making a whole system that tracks light on a per-tile level (or maybe the latter option is better)?
I am using
Unity 2020.3.6f1 and the
URP, which means I’m going to be using the ‘new’ 2D lights.
When it’s nighttime, I’m going to disable the global light (sun) so those tiles will be pitch black.
When it’s daytime, the global light will have an intensity of 1 so that tile will have 100% brightness (look normal).
When it’s nighttime, but there’s a torch, the tile where the torch is sitting on will have 100% brightness, and that will slowly fade to 0% over a span of 5 tiles.
Making a system that updates every single tile in the game with information about the light level seems pretty expensive. Is there a way we can observe a block “graphically”, or in other words, literally look at the pixel on the screen, and determine it’s alpha value to check for light level?
Any suggestion is super welcome.