- Home /
Flashlight Effect (2D Top Down)
Hi, i'm making a top down 2d horror game. I need a flash light effect but not with normal lighting systems. The darkness of the rooms wouldn't really be a lack of light, but a black plane object. The area that makes up the flashlight's flash would be something that erases parts of the black plane above it. Something to that effect anyway.
Basically what i mean is just how the flash HM works in pokemon. http://lparchive.org/Pokemon-LeafGreen/Update%2012/8-pokemonleafgreenu121hn.png Where the area around your character is visible but everything around that isn't.
Answer by SterlingSoftworks · Jan 22, 2016 at 06:54 AM
This is easily done outside of Unity.. Just create a black image with a transparent center. Then create an empty gameobject as a child of your player character, and add a Sprite Renderer component using that image as the sprite. And now in a script somewhere where you're wanting to mess with this "flashlight" effect, turn the gameobject (or Sprite Renderer) on/off. Shouldn't be anything too fancy to recreate the image effect. :)
There are many ways you could achieve this - image effects, the stencil mask, a shader with conditional distance check, but sometimes the simplest option is the best :) +1
Oh wow, I can't believe I never thought of this. Thanks buddy, sorry to bother with the stupid question. XD
Nooooo problem mate! Like @tanoshimi said, the simplest option is the best ;D
Don't forget to mark this question answered/closed too :)
Your answer
![](https://koobas.hobune.stream/wayback/20220612061217im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2D Light + Normal Maps with Sprite Mask? 3 Answers
Torchlight effect in 2D 3 Answers
Directional light 2D 0 Answers
Prevent light combining with other lights 0 Answers
2D dash in coroutine Inconsistent 1 Answer