- Home /
I solved this problem by myself.
Fog of war for a 2D game.
Hi,
i'm a beginner on Unity. I'm currently working on a simple 2D RPG game with a top view system who follow my player object on a "map scene". I'm looking for a solution to create a fog of war on the map and i don't know how to do it. I read some post and watched some tutorial but i can't find a solution yet. Don't know if i need to use shader or mesh or an other way...
If someone can help me, he will be a hero ^^
Thanks in advance!
Generate a mesh over the terrain, and give it a shader which supports vertex colors. Set the vertex colors to black. When exploring, set the vertex color of the nearest vertices to alpha 0.
Lots of tutorials for this, some also use special shaders.
Thanks for your quick answer, but i'm just using Sprite right now and i can't use mesh on it... I maybe don't use the good way, as i say i'm a beginner in Unity and i don't know how tu use many of 3d element.
It doesn't matter if you use sprites or not. In Unity, a sprite is still just a mesh (quad), and so is 2d tiled terrain.
Answer by b1gry4n · Oct 17, 2016 at 06:10 PM
Google is your friend.
http://answers.unity3d.com/questions/766534/how-to-make-a-fog-of-war-with-textures.html
Answer by uni-ToZoR · Oct 17, 2016 at 06:41 PM
Thanks for your reply, But i already find that post and saw this tutorial, i don't know how to use it in a 2D project... I don't know how to use plane in a 2D environement. i can't get it visible even if i rotate it. That's my problem.
Answer by uni-ToZoR · Oct 17, 2016 at 06:41 PM
Hi, thanks, but i already this this post and the tutorial, but it's for 3D environement and i work in a 2D project, i don't know how to use element like plane, if i rotate it, it does not appear. i really don't know how to use in 2d...