Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Simple Day/Night Cycle

Discussion in 'Made With Unity' started by OrbitusII, May 28, 2012.

  1. OrbitusII

    OrbitusII

    Joined:
    Jul 4, 2011
    Posts:
    175
    Just a simple script that can simulate a day/night cycle. Like my door opener script, it can be attached to any gameobject and will still work so long as the objects in the inspector are specified.

    The test scene with the script. You can change the "Day Length" variable in the inspector to make the days longer or shorter.
    View attachment $DayNightCycle.unitypackage

    C&C appreciated!
     
    Last edited: May 28, 2012
  2. venhip

    venhip

    Joined:
    Jul 7, 2012
    Posts:
    6
    This is really good, thank you! Only trouble is it doesn't effect the skybox, I'm going to add in a counter to blend day and night skyboxes together, may i suggest adding something similar to your script? It'd just make it perfect :)
     
  3. 3dDude

    3dDude

    Joined:
    Jul 4, 2010
    Posts:
    1,067
    Pictures/video?
     
  4. OrbitusII

    OrbitusII

    Joined:
    Jul 4, 2011
    Posts:
    175
    My apologies for the late reply, Venhip.

    I am working on a better version of the script, so I should be able to get that up in the next week, maybe? I'll look into the skybox effects as I get the script working.

    3dDude, I will try and get some pictures up soon.
     
  5. Chowbox87

    Chowbox87

    Joined:
    Jul 3, 2013
    Posts:
    2
    How do I add a rotation axis to this?
     
  6. OrbitusII

    OrbitusII

    Joined:
    Jul 4, 2011
    Posts:
    175
    I recently wrote a better version of this, so I'll work on getting that up. It doesn't have multiple rotational axes yet, but I'll be sure to add that when I get the chance. :)
     
  7. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    wow very nice thanks!
     
  8. MohammadAlizadeh

    MohammadAlizadeh

    Joined:
    Apr 16, 2015
    Posts:
    26
    two years passed bro where's ur new D&Ncycle:D
     
  9. MakerBen

    MakerBen

    Joined:
    Sep 27, 2019
    Posts:
    2
    5 more years