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 /
  • Help Room /
avatar image
0
Question by Basakot · Apr 29, 2016 at 12:04 PM · cycledaynight

2D Top Down Day/Night Cycle

This is one of the biggest questions about making games for me. How to make a day-night cycle in a 2D Top-Down shooter? I've been searching for a long time, but i found nothing about a top down shooter day-night cycle.

Can anyone help me?

Comment
Add comment · Show 3
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 Scribe · Apr 29, 2016 at 12:32 PM 0
Share

you mean just to change the intensity of the light? Or some more indepth night vs day functionality?

avatar image Basakot · Apr 29, 2016 at 12:43 PM 0
Share

@Scribe I have no light in my game(2D), i want some more indepth night/day functionality. Also the game is a top down shooter. I just want when it's day objects to be lu$$anonymous$$ous, and when it's night to be very dark.

avatar image Scribe Basakot · Apr 29, 2016 at 01:42 PM 0
Share

you are using unlit shaders then I assume? You could add some global shader properties, like 'lightness' which you adjust from code to alter the brightness of your tiles. If the shadows of the game are painted directly into the tiles, you may find it difficult to mess with them, if they are separate sprites, you could try scaling them either through shaders or transforms, and changing their positions, based on where someone would expect the 'sun' to be.

It is quite easy to set up a timer, to keep track of the time of day/night and dates/time of year etc, all of which is not explicit to a 2D game, so for the indepth functionality, you can just look for general day-night handling and ti$$anonymous$$g.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Winterblood · Apr 29, 2016 at 12:45 PM

Same as any other game, except that since you can't see the sky itself, you'll have to convey the time of day by the angle and colour of the light cast on the scene - orange/yellow with long shadows at dawn, white with short shadows at noon, orange/pink with long shadows in the opposite direction at sunset, blue at night with faint moonshadows.

Set up a directional light and play around with controlling it's direction, colour and brightness from code.

[EDIT: Sorry, missed the "2D". In that case you'll have to just tint your sprites - although there are some 2D shadow-approximating plugins you could try.]

Comment
Add comment · 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

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

55 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 avatar image avatar image

Related Questions

UnityEngine.Invoke() Doesn't work properly with values under 1? 0 Answers

Day/Night cycle turns black at night and how to Serialize it rightly? 0 Answers

Sun Variable Rotation 1 Answer

change one object into another, and then back again 1 Answer

Why does my Color.Lerp switch the colors on every other cycle? 0 Answers


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