• 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 /
This question was closed Nov 15, 2013 at 05:10 PM by fafase for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by RealMTG · Nov 15, 2013 at 03:33 PM · checksomethingdatedo

[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

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 roojerry · Nov 15, 2013 at 03:55 PM 0
Share

How about checking System.Datetime.Today?

avatar image RealMTG · Nov 15, 2013 at 03:57 PM 0
Share

I don't know how to code in C#. I only know how to code in JavaScript

avatar image roojerry · Nov 15, 2013 at 04:01 PM 0
Share

You can import the System class into your javascript class. This has been answered before

1 Reply

  • Sort: 
avatar image
3
Best Answer

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!");
 }
Comment
Add comment · Show 6 · 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 RealMTG · Nov 15, 2013 at 04:17 PM 0
Share

Thank you so much! :D

Also, how do I do so I can make the year doesn't matter?

avatar image tanoshimi · Nov 15, 2013 at 04:56 PM 0
Share

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");
 }
avatar image RealMTG · Nov 15, 2013 at 04:59 PM 0
Share

Thanks! :D

avatar image tanoshimi · Nov 15, 2013 at 05:01 PM 0
Share

No problem. Please mark as the answer to keep the board tidy. Thanks!

avatar image tanoshimi · Nov 15, 2013 at 06:14 PM 0
Share

@fafase - Please do not close questions that have not yet had answers accepted. It makes the board very untidy!

Show more comments

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

19 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

Related Questions

Bootcamp damage 0 Answers

Check if object is applying force to another object 0 Answers

If destroyed? how to check if destroyed? 1 Answer

Checking for divisible by 2 2 Answers

Is it possible to check which point is being touched? 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