Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by xevierh · Jan 22, 2016 at 06:40 AM · 2dlightingmasktop-down

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

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. :)

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tanoshimi · Jan 22, 2016 at 07:23 AM 0
Share

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

avatar image xevierh · Jan 22, 2016 at 12:45 PM 0
Share

Oh wow, I can't believe I never thought of this. Thanks buddy, sorry to bother with the stupid question. XD

avatar image SterlingSoftworks xevierh · Jan 22, 2016 at 05:15 PM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

53 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges