Unity days system in c#

rooter

Newbie
Sep 5, 2019
23
26
sorry for my english:(
i just start learn C#...just 2 week ago
i already make day and night cycle in unity,the problem is dont know how to make day1 == monday, day2 == tuesday....... so on
loop or array +_+ please help
 
Last edited:

Droid Productions

[Love of Magic]
Donor
Game Developer
Dec 30, 2017
6,720
17,021
I use DateTime

public DateTime Today { get { return new DateTime(startYear, startMonth, startDay).AddDays(World.getSave.CurrentDayIdx); }}

(where startYear/startMonth/start day is an arbitrary start-time for my game).

From there you can easily get things like day of week / day of month, etc.

(Today.DayOfWeek, etc)
 
  • Like
Reactions: Papa Ernie

rooter

Newbie
Sep 5, 2019
23
26
I use DateTime

public DateTime Today { get { return new DateTime(startYear, startMonth, startDay).AddDays(World.getSave.CurrentDayIdx); }}

(where startYear/startMonth/start day is an arbitrary start-time for my game).

From there you can easily get things like day of week / day of month, etc.

(Today.DayOfWeek, etc)

Thank You So Much for Help (y)
 
  • Like
Reactions: Droid Productions