- Home /
The question is answered, right answer was accepted
[ANSWERD] Do something when it is the correct date
Hi!
I am trying to make a game and I would like to add as easter eggs that the player gets diffrent skins when it is like Halloween or christams. So for example, when it is 31 October (Hallowee), my player will get a custom texture and my music will change. How do I do something in the style with this?
Thanks
I don't know how to code in C#. I only know how to code in JavaScript
You can import the System class into your javascript class. This has been answered before
Answer by tanoshimi · Nov 15, 2013 at 04:07 PM
var thisDate = System.DateTime.Today;
var halloweenDate = System.DateTime(2013, 10, 31, 0, 0, 0);
if(thisDate.Date.Equals(halloweenDate)) {
Debug.Log("Happy Halloween!");
}
Thank you so much! :D
Also, how do I do so I can make the year doesn't matter?
For that, just compare the $$anonymous$$onth and Day components:
var thisDate = System.DateTime.Today;
if(thisDate.$$anonymous$$onth == 10 && thisDate.Day == 31) {
Debug.Log("Today is the 31st of October, in any year");
}
No problem. Please mark as the answer to keep the board tidy. Thanks!
@fafase - Please do not close questions that have not yet had answers accepted. It makes the board very untidy!