Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
3
Question by flexrails · Dec 03, 2009 at 03:53 PM · guidatetimedate

calendar gui for date selection

how do i create a calendar gui in unity, so that i can select a specific date? thanks, flexrails

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

4 Replies

· Add your reply
  • Sort: 
avatar image
5
Wiki

Answer by Nicolaj Schweitz · Dec 09, 2009 at 10:46 PM

Check msdn for custom formatting of date strings and play around with how the GUI system works in general to e.g. browse around a calendar using conditional buttons or toggles.

using UnityEngine; using System.Collections; using System; //Unity does not add this by default when creating a new script

public class CalendarGUI : MonoBehaviour { private string[] Months;

 void Start()
 {
     //fill an array with the names of the months
     Months = new string[12];
     System.DateTime iMonth = new System.DateTime(2009,1,1);
     for (int i = 0; i < 12; ++i) 
     {
         iMonth = new System.DateTime(2009, i+1, 1);
         Months[i] = iMonth.ToString("MMMM");
     }
 }

 void OnGUI () 
 {
     //show the months in a grid and select the current month
     GUILayout.SelectionGrid(System.DateTime.Now.Month-1, Months, 3);
 }

}

It can easily be modified to show weekdays, dates and virtually anything from System.DateTime.

Have fun! I'm looking forward to see what you come up with.

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

Answer by Statement · Dec 03, 2009 at 04:10 PM

Start with designing and capturing requirements for what you want to be the end product. Then I suppose it's just a bunch of buttons and states, and listing which days are found for a given month (or how you want to present the view of the calendar). I think you can find some helping methods in the .NET DateTime class.

But first and foremost, make clear for yourself how you want the calendar to look, feel and behave.

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

Answer by TowerOfBricks · Dec 09, 2009 at 05:01 PM

For the GUI I suggest you take look at GUILayout.SelectionGrid which can provide you with an easy way of setting up your buttons in the calendar, after that, it is just design which varies a lot from calendar to calendar.

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

Answer by Uchiha Itachi · Jan 22, 2014 at 04:49 AM

I don't have much time for a more complete answer, unfortunately, but I'd try uitable to create a table and to define the CellSelectionCallback to get the date.

 Here's a bit to get you started:
 
 dates = calendar;
 dates(~any(dates,2),:) = [];
 fh = figure;
 uh = uitable('parent',fh,'data',dates,'ColumnWidth',repmat({20},1,7),...
              'ColumnName',{'S','M','T','W','T','F','S'});


Anyway, this reminds of the C# calendar, I read through all the calendar control tutorial, but nothing found for the for the date selection.

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

1 Person is following this question.

avatar image

Related Questions

How do you list all the days of the current month? 1 Answer

how do i implement a date picker that is similar to the date picker from iphone/ipad 0 Answers

Get date from server? 0 Answers

Timestamp and Date from Unity? for mobile 2 Answers

Using a calendar in my game 1 Answer


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