Hi, I have a question about the CalendarUnit enum, i'm using it for LocalNotifications in my app. Thing is my client wants to choose between the following repeatintervals: - hourly (default so no problem) - every 3 hours - every 5 hours - every 10 hours Since the CalendarUnit is an enum I can't add new items to it. I tried debugging to see what the CalendarUnit variable actually returns but it simply prints Hour. I also tried: Code (CSharp): Debug.Log (CalendarUnit.Hour + 3 + " and Unit converted to int: " + System.Convert.ToInt32(CalendarUnit.Hour)); This prints the following: 35 and Unit converted to int: 32 Don't really know where those values stand for. Any ideas?
http://docs.unity3d.com/ScriptReference/CalendarUnit.html The integer value of each unit is just a power 2, in the order shown (starting from 2), presumably so you can combine different ones and get a unique value. You should just make your own enum enum myTimes { OneHour, ThreeHours, FiveHours, TenHours } Code (CSharp): enum myTimes { OneHour, ThreeHours, FiveHours, TenHours } myTimes time; void OnGUI () { time = (myTimes) EditorGUILayout.EnumPopup( time ); }
Hi hpjohn, Thanks for your reply! Thing is, LocalNotification.repeatInterval only accepts a CalendarUnit. So I think creating my own Enum isn't going to work.