itch.io is community of indie game creators and players

Devlogs

2D Mobile Optimized Lighting System

My personal Devlog
A downloadable tool

I'm working on a 2D lighting system for Unity. The quick story is I was going to add the Unity's Light2D into my mobile 2D game, but when I downloaded it, I soon realized there would be a problem as that lighting system didn't have shadow casting implemented. So I spent almost an entire week and a lot of hours implementing a collider-based wall detection which calculated shadows in a shader.. and after a pretty sweet result in my PC, I realized I had to test on my phone... 6 fps. After a bit of testing and profiling I realized the problem came from the mere Light2D that Unity implemented, so a bit mad at Unity I started creating my own really basic SpriteRenderer-based light, and implemented my previous shadow calculation system in it. Up to now, I have a single component light working with a SpriteRenderer on the same GameObject, with a couple settings for adapting the light to your needs. Also, this light (updating at every frame, which isn't necessary, runs at 40 - 50 fps in my phone!)

Read comments (3)